Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL][PHP]Błąd logowania
Forum PHP.pl > Forum > Przedszkole
bovtek8
Witam, zainstalowałem sobie skrypt - instalacja przebiegła poprawnie, lecz na stronie logowania występuje poniższy błąd.

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/bovtek/ftp/classes/mysql.class.php on line 75

Oto kod pliku mysql.class.php
  1. <?php
  2. /**************************************************************************
  3.  * XXXXXX
  4.  * XXXXX
  5.  * Wszystkie prawa zastrzeżone
  6.  *
  7.  * Autor skryptu:
  8.  * XXXXXX
  9.  **************************************************************************/
  10.  
  11. class MySQL {
  12.  
  13. var $db = array();
  14. var $value = array();
  15.  
  16. function __construct()
  17. {
  18. if (class_exists('Error')) {
  19. include "error.class.php";
  20. $error = new Error();
  21. }
  22.  
  23. if(!mysql_connect(SQL_HOST,SQL_USER,SQL_PASS)):
  24. if(defined("DEBUG")): $error->mysql(1000); endif;
  25. endif;
  26. if(!mysql_select_db(SQL_NAME)):
  27. mysql_query("CREATE DATABASE ".SQL_NAME); if(defined("DEBUG")): $error->mysql(1001); endif;
  28. endif;
  29. if(!mysql_query("SET NAMES UTF8")):
  30. if(defined("DEBUG")): $error->mysql(1002); endif;
  31. endif;
  32. }
  33.  
  34. /**
  35.   * Zapytanie: $sql->sqlQuery
  36.   * @return
  37.   */
  38.  
  39. function sqlQuery($select)
  40. {
  41. $this->query = mysql_query($select);
  42. if($this->debug==true): echo $select; endif;
  43. if($this->query):
  44. while($this->row = mysql_fetch_assoc($this->query)) { $db[] = $this->row; }
  45. else:
  46. $error = mysql_errno();
  47. endif;
  48. if(!isset($db)): $error = mysql_errno(); else: return $db; endif;
  49. }
  50.  
  51. /**
  52.   * Zapytanie: $sql->sqlExec
  53.   * @return
  54.   */
  55.  
  56. function sqlExec($select, $table, $option)
  57. {
  58. $this->db = NULL;
  59. $this->query = mysql_query("SELECT ".$select." FROM ".$table." ".$option);
  60. if($this->query):
  61. while($this->row = mysql_fetch_assoc($this->query)) { $this->db[] = $this->row; }
  62. else:
  63. $error = mysql_errno();
  64. endif;
  65. if(!isset($this->db)):
  66. $error = mysql_errno();
  67. else:
  68. return $this->db;
  69. endif;
  70. }
  71.  
  72. function sqlRow($select, $table, $option)
  73. {
  74. $this->query = mysql_query("SELECT ".$select." FROM `".$table."` ".$option);
  75. $this->row = mysql_fetch_assoc($this->query);
  76. return $this->row;
  77. }
  78.  
  79. function sqlInsert($table,$values)
  80. {
  81. if($this->query = mysql_query("INSERT INTO $table VALUES($values)")):
  82. return true;
  83. else:
  84. return false;
  85. endif;
  86. }
  87.  
  88. function sqlDelete($table,$where)
  89. {
  90. $this->query = mysql_query("DELETE FROM $table WHERE $where");
  91. }
  92.  
  93. function sqlUpdate($table,$values,$where)
  94. {
  95. if(!isset($table)): die('class.mysql.php : nie podano wymaganych parametrów'); endif;
  96. if(!isset($values)): die('class.mysql.php : nie podano wymaganych parametrów'); endif;
  97. if(!isset($where)): die('class.mysql.php : nie podano wymaganych parametrów'); endif;
  98.  
  99. $this->query = mysql_query("UPDATE $table SET $values WHERE $where LIMIT 1");
  100.  
  101. return true;
  102. }
  103.  
  104. /**
  105.   * Sprawdzanie czy wybrany rekord znajduje się w bazie danych
  106.   * @param object $table - nazwa tabeli
  107.   * @param object $where - warunek where
  108.   * @return true lub false
  109.   */
  110. function sqlCheck($table, $where)
  111. {
  112. $this->query = mysql_query("SELECT * FROM $table WHERE $where");
  113. @$this->numrows = mysql_num_rows($this->query);
  114.  
  115. if($this->numrows==0):
  116. return false;
  117. elseif($this->numrows>0):
  118. return true;
  119. endif;
  120. }
  121.  
  122. function sqlGetLastId($table, $id)
  123. {
  124. $this->query = mysql_query("SELECT * FROM ".$table." ORDER BY ".$id." DESC");
  125. $this->row = mysql_fetch_array($this->query);
  126. return $this->row;
  127. }
  128.  
  129. function sqlCount($table, $where=null)
  130. {
  131. if(empty($where)):
  132. $query = mysql_query("SELECT * FROM ".$table);
  133. else:
  134. $query = mysql_query("SELECT * FROM ".$table." WHERE ".$where);
  135. endif;
  136.  
  137. if(isset($this->row)):
  138. $this->row = @mysql_num_rows($query);
  139. return $this->row;
  140. else:
  141. return 0;
  142. endif;
  143. }
  144.  
  145. public function generateIdent( $length )
  146. {
  147. $pw = 0;
  148. for($i=0;$i<$length;$i++) {
  149. switch(rand(1,3)):
  150. case 1:
  151. $pw.=chr(rand(48,57));
  152. break; //0-9
  153. case 2:
  154. $pw.=chr(rand(65,90));
  155. break; //A-Z
  156. case 3:
  157. $pw.=chr(rand(97,122));
  158. break; //a-z
  159. endswitch;
  160. }
  161. return $pw;
  162. }
  163.  
  164.  
  165.  
  166. /* function __destruct()
  167.   {
  168.   $error = new Error();
  169.   if(!@mysql_close($this->sqlIdent)):
  170.   if(defined("DEBUG")): $error->mysql(1003); endif;
  171.   endif;
  172.   } */
  173. }
  174. ?>


Proszę o rozwiązanie mojego problemu winksmiley.jpg
potreb
mysql_error();
bovtek8
Cytat(potreb @ 11.09.2010, 20:57:09 ) *
mysql_error();


Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/bovtek/ftp/classes/mysql.class.php on line 75
1146: Table 'bovtek.avatec_texts' doesn't exist
grzemach
"Table 'bovtek.avatec_texts' doesn't exist", sprawdź gdzie w tej nazwie ("avatec_texts") masz błąd, bo taka tabela nie istnieje w bazie winksmiley.jpg
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.