Jump to content

mysql_fetch_array error


monkeypaw201

Recommended Posts

<?php

$con = mysql_connect("localhost","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM smf_messages");

while($row = mysql_fetch_array($result))
  {
echo "hi";
}
mysql_close($con);

?>

 

the error:

PHP Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in test.php on line 13
Link to comment
https://forums.phpfreaks.com/topic/105033-mysql_fetch_array-error/
Share on other sites

Or this

$con = mysql_connect("localhost","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM smf_messages");

while($row = @mysql_fetch_array($result))
  {
echo "hi";
}
mysql_close($con);

Archived

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

×
×
  • 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.