Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP]Znikający resource
tmgryf
post
Post #1





Grupa: Zarejestrowani
Postów: 79
Pomógł: 1
Dołączył: 14.02.2009

Ostrzeżenie: (0%)
-----


Hello - wiem ze jest pozno i mozliwe dla tego nie wiem co robie zle ale:

  1. if (!$result) {
  2. $message = 'Invalid query: ' . mysql_error() . "\n";
  3. $message .= 'Whole query: ' . $qry;
  4. echo $message;
  5. die();
  6. }
  7. $num_rows = mysql_num_rows($result);
  8. var_dump($num_rows,$result);
  9. if ($num_rows == 0)
  10. {
  11. echo "You are not authorized to use this app";
  12. return;
  13. }
  14. else
  15. while ($row = mysql_fetch_assoc($result)) {
  16.  

var_dump zwraca
  1. int(1) resource(9) of type (mysql result)


I zaraz w while wyskakuje mi blad:

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\carpl\ajax\sessionValidation.php on line 42


W jakis automagiczny sposob nastepuje konwersja z Resource na Bool wtf? - Ale pewnie juz pozno jest i ja czegos juz nie widze....
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




A w pętli WHILE przypadkiem nie nadpisujesz zmiennej $result ?
Go to the top of the page
+Quote Post
mmmmmmm
post
Post #3





Grupa: Zarejestrowani
Postów: 1 421
Pomógł: 310
Dołączył: 18.04.2012

Ostrzeżenie: (0%)
-----


Wywal var_dumpa.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 13:28