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:13 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 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 09 March 2006 - 10:39 AM

Hello Tokkille,

most likely you will have an error in your sql.
please run the query like this
mysql_query($Query) or die(mysql_error());

this will get your the error and this error will help you.

anatak
takasi.8008@docomo.ne.jp
tourokum@0508.jp

#3 tokkille

tokkille
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 09 March 2006 - 10:52 AM

anatak,

Thanks alot i fixed it!!!!!

Im super grateful!!!!

Tokkille




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users