Jump to content

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/4519-cant-recive-database-query/
Share on other sites

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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.