Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Problem z korzystaniem z mysql_result
Balon
post
Post #1





Grupa: Zarejestrowani
Postów: 422
Pomógł: 0
Dołączył: 14.12.2005
Skąd: Wałbrzych

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


  1. <?php
  2. $query_char= mysql_query('SELECT hp_char FROM fight WHERE user=$user');
  3. $query_mob= mysql_query('SELECT hp_mob FROM fight WHERE user=$user');
  4. $mob_hp = mysql_result($query_mob, 0, 0);
  5. $char_hp = mysql_result($query_char, 0, 0);
  6. ?>


taki kod wywala mi blad

Kod
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/soonhost/public_html/tury.php on line 35

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/soonhost/public_html/tury.php on line 36


w tej tabeli mam tylko jeden rekord . nie wiem dalczego to nie dziala... przeciez nie ma tu nigdzie zadnego bledu ...

prosze o pomoc

Ten post edytował Balon 9.03.2006, 19:08:57
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
mike
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


A jakiego typu jest pole user? Pole tekstowe jakieś?
  1. <?php
  2.  
  3. $resQueryChar = mysql_query( "SELECT hp_char FROM fight WHERE user = '" . $user ."'" );
  4. $resQueryMob = mysql_query( "SELECT hp_mob FROM fight WHERE user = '" . $user . "'");
  5.  
  6. if( mysql_num_rows( $resQueryChar ) > 0 )
  7. {
  8. while( $arrRow = mysql_fetch_array( $resQueryChar ) )
  9. {
  10. $char_hp = $arrRow[ 'hp_char' ];
  11. }
  12. }
  13. else
  14. {
  15. echo 'zapytanie 1 nie zwróciło wyników';
  16. }
  17.  
  18.  
  19. if( mysql_num_rows( $resQueryMob ) > 0 )
  20. {
  21. while( $arrRow = mysql_fetch_array( $resQueryMob ) )
  22. {
  23. $char_mob = $arrRow[ 'hp_mob' ];
  24. }
  25. }
  26. else
  27. {
  28. echo 'zapytanie 2 nie zwróciło wyników';
  29. }
  30.  
  31. ?>

I jak teraz :?:
Go to the top of the page
+Quote Post

Posty w temacie


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: 9.10.2025 - 16:22