Warning: mysql_fetch_array(): supplied argument is not a val
Posted: Wed Feb 11, 2009 4:26 pm
Hi,
I had already posted this, but can't see it, so sorry if this is a repeat.
I am trying to connect to my database with the following code:
mysql_connect("localhost","xxxxxx_username","password") or die ("Could not connect");
mysql_select_db("xxxxx_dbname");
print 'You are connected';
$get_strategies = "SELECT strategy_id, strategy_title FROM strategies WHERE ind_published = 1 ORDER BY display_order ";
$result = mysql_query($get_strategies);
while ($a = mysql_fetch_array($result))
{
echo "<a href='strategy.php?strategy_id=".$a[strategy_id]."'class='navLinkBody' > ".$a[strategy_title]."</a><br>";
}
I get the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
I am using the correct username, password and database name. I have tested my SQL statement, which is correct. I seem to be connecting to the database, as I get the message that I have connected.
I have run this code with other providers and it works.
Any ideas?
I had already posted this, but can't see it, so sorry if this is a repeat.
I am trying to connect to my database with the following code:
mysql_connect("localhost","xxxxxx_username","password") or die ("Could not connect");
mysql_select_db("xxxxx_dbname");
print 'You are connected';
$get_strategies = "SELECT strategy_id, strategy_title FROM strategies WHERE ind_published = 1 ORDER BY display_order ";
$result = mysql_query($get_strategies);
while ($a = mysql_fetch_array($result))
{
echo "<a href='strategy.php?strategy_id=".$a[strategy_id]."'class='navLinkBody' > ".$a[strategy_title]."</a><br>";
}
I get the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
I am using the correct username, password and database name. I have tested my SQL statement, which is correct. I seem to be connecting to the database, as I get the message that I have connected.
I have run this code with other providers and it works.
Any ideas?