Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: mysql_numrows();
Forum PHP.pl > Forum > Bazy danych > MySQL
andy84
witam to moj skrypt
  1. <?
  2. $username="root";
  3. $password="";
  4. $dbname="formularz";
  5. mysql_connect(localhost,$username,$password);
  6. @mysql_select_db($dbname) or die("unable to connect to database");
  7. $query="SELECT*FORM dane";
  8. $result=mysql_query($query);
  9.  
  10. $num=mysql_numrows($result);
  11.  
  12. echo "<b><center>Customer informations</center></b><br><br><br>";
  13.  
  14. $i=0;
  15. while ($i<$num){
  16. $first=mysql_result($result,$i,'first');
  17. $last=mysql_result($result,$i,'last');
  18. $email=mysql_result($result,$i,'email');
  19. $address=mysql_result($result,$i,'address');
  20. $city=mysql_result($result,$i,'city');
  21. $town=mysql_result($result,$i,'town');
  22. $zip=mysql_result($result,$i,'zip');
  23. $tel=mysql_result($result,$i,'tel');
  24. $fax=mysql_result($result,$i,'fax');
  25. $service=mysql_result($result,$i,'option');
  26. $comment=mysql_result($result,$i,'comment');
  27.  
  28. echo "$first $last<br>$email<br>$address<br>$city<br>$town<br>$zip<br>$tel<br>$fax<br>$service<br>$comment";
  29. $i++;
  30. }
  31. ?>

nie iwemczemu mysql_numrows mi wywala blad sad.gif jak dubluje jakis temat to przepraszam moze poprostu nie szukame dobrze
ikioloak
bo to nie jest funkcja mysql_numrows() tylko mysql_num_rows()
andy84
Cytat(ikioloak @ 2005-11-19 11:23:12)
bo to nie jest funkcja mysql_numrows() tylko mysql_num_rows()

zmenilem to i nadal to samo sad.gif

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\appserv\www\websignuk\bazawebsign\index.php on line 9

kod wyglada j/w ze zmienionym mysql_numrows na mysql_num_rows
ghostrider
  1. <?php
  2. $result = mysql_query("SELCT * FROM dane");
  3.  
  4. if (!is_resource($result)) {
  5. }
  6. ?>


trzeba sprawdzac czy sie niema bledu w zapytaniu SQL.
andy84
Cytat(ghostrider @ 2005-11-19 11:35:57)
  1. <?php
  2. $result = mysql_query("SELCT * FROM dane");
  3.  
  4. if (!is_resource($result)) {
  5. }
  6. ?>


trzeba sprawdzac czy sie niema bledu w zapytaniu SQL.

  1. <?
  2. $username="root";
  3. $password="";
  4. $dbname="formularz";
  5. mysql_connect(localhost,$username,$password);
  6. @mysql_select_db($dbname) or die("unable to connect to database");
  7. $query="SELECT*FORM dane";
  8. if (!is_resource($result)) {
  9. }
  10. $result=mysql_query($query);
  11. $num=mysql_num_rows($result);
  12.  
  13. echo "<b><center>Customer informations</center></b><br><br><br>";
  14.  
  15. $i=0;
  16. while ($i<$num){
  17. $first=mysql_result($result,$i,'first');
  18. $last=mysql_result($result,$i,'last');
  19. $email=mysql_result($result,$i,'email');
  20. $address=mysql_result($result,$i,'address');
  21. $city=mysql_result($result,$i,'city');
  22. $town=mysql_result($result,$i,'town');
  23. $zip=mysql_result($result,$i,'zip');
  24. $tel=mysql_result($result,$i,'tel');
  25. $fax=mysql_result($result,$i,'fax');
  26. $service=mysql_result($result,$i,'option');
  27. $comment=mysql_result($result,$i,'comment');
  28.  
  29. echo "$first $last<br>$email<br>$address<br>$city<br>$town<br>$zip<br>$tel<br>$fax<br>$service<br>$comment";
  30. $i++;
  31. }
  32. ?>

no i teraz bledow nie ma ( nie ma nic na stronie :| nie mam pojecia co jest z tym
ghostrider
Cytat
  1. <?php
  2. $query="SELECT*FORM dane";
  3. if (!is_resource($result)) {
  4. }
  5. $result=mysql_query($query);
  6. $num=mysql_num_rows($result);
  7. ?>


ma byc:
  1. <?php
  2.  
  3. $query="SELECT*FORM dane";
  4. $result=mysql_query($query);
  5.  
  6. if (!is_resource($result)) {
  7. }
  8. $num=mysql_num_rows($result);
  9. ?>
andy84
Cytat(ghostrider @ 2005-11-19 11:47:57)
Cytat
  1. <?php
  2. $query=&#092;"SELECT*FORM dane";
  3. if (!is_resource($result)) {
  4. }
  5. $result=mysql_query($query);
  6. $num=mysql_num_rows($result);
  7. ?>


ma byc:
  1. <?php
  2.  
  3. $query="SELECT*FORM dane";
  4. $result=mysql_query($query);
  5.  
  6. if (!is_resource($result)) {
  7. }
  8. $num=mysql_num_rows($result);
  9. ?>

dobra mastery odkrylem co jest dzieki pomogles ostatnia komenda if

jak sie przyjzycie to glupi by tlko na to wpadl napisalem
$query="SELECT*FORM dane"; <---
a powinno byc tongue.gif

$query="SELECT*FROM dane"; <co za glupi blad prawda dwie literki przestawione dzieki chlopaki biggrin.gif( sory jezeli sa jakies dziewczyny w tej konwersacji smile.gif
nospor
Przenosze na MySql. W końcu tego konkretnie dotyczy problem, wiec czemu od razu tam sie nie znalazł?
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.