Jump to content


Photo

Cant recive database query!?


  • Please log in to reply
2 replies to this topic

#1 tokkille

tokkille
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 09 March 2006 - 10:36 AM

When i try to recive data from my database i get the following error message (on the webpage):

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /customers/vahlne.se/vahlne.se/httpd.www/index.php on line 18

My code in PHP looks as follows (from row 13(<?php)-24(?>)):

<?php
include("XXX.php");
$result = mysql_query("SELECT * FROM maraton1 ORDER BY Plats ASC",$db);
echo "<table border=1 align=center cellspacing=2 cellpadding=3>\n";
echo "<TR><TH>Plats<TH>Lag<TH>Poäng</TR>\n";
while ($rad = mysql_fetch_array($result))
{
echo "<TR><TD>$rad[Plats]<TD>$rad[Lag]<TD>$rad[Poäng]\n";

}
echo "</TABLE>";
?>



Would be greatful for all help!!

Thanks alot,

Tokkille


#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 09 March 2006 - 12:19 PM

basicaly that means there is an error in your SQL

change: $result = mysql_query("SELECT * FROM maraton1 ORDER BY Plats ASC",$db);

to: $result = mysql_query("SELECT * FROM maraton1 ORDER BY Plats ASC",$db) OR die(mysql_error());

and that will give you an error that will say what the problem with the statement is
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 tokkille

tokkille
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 09 March 2006 - 01:18 PM

Thanks for the help!!!!!

/Tokkille




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users