The following code connects to the database but I am unable to fetch any records from a table. I have seen the example code in several places so I assume it is correct.
I can access the table via a Perl script but the log in for that also includes the Database name but the PHP version connects without the database name.
What am I missing?
and returns the following
Keith
I can access the table via a Perl script but the log in for that also includes the Database name but the PHP version connects without the database name.
What am I missing?
Code:
<?php
$username = "xxxxxxxx";
$password = "yyyyyyyy";
$hostname = "00,00,000,000";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
$query = "SELECT NUM,XAXIS,YAXIS FROM MORETOUR";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "Num :{$row['NUM']} <br>" .
"XAXIS : {$row['XAXIS']} <br>" .
"YAXIS : {$row['YAXIS']} <br><br>";
}
?>
Code:
Connected to MySQL
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /ServerPathAndScriptName on line 14
Keith