Jump to content

Sql Error Very Basic Problem


Craig Hopson

Recommended Posts

hi just learning SQL stuff getting this error thoWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource inthis is the script im using

<?php$con = mysql_connect("localhost","mysite_test","test1");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("my_db", $con);$result = mysql_query("SELECT * FROM test_members");while($row = mysql_fetch_array($result))  {  echo $row['FirstName'] . " " . $row['LastName'];  echo "<br />";  }?>

i know it will be something silly but i'm stuck lol

Link to comment
Share on other sites

I am pretty sure it detects the connection automatically, however I just want to point out that you can add the connection variable in the mysql_query() so it knows exactly where to look. ex:$result_set = mysql_query($query, $connection)

Link to comment
Share on other sites

  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...