Here is the error message: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\public_html\mysql_test.php on line 15
My local server setup:
Apache 2.2.9.
PHP 5.2.6.
MySQL 5
Here is the tutorial I have been following.
Everything has gone smoothly up until now. http://www.bicubica.com/apache-php-mysql/
I am stuck on Configuring PHP to work with MySQL.
$conn = mysql_connect("".MYSQL_HOST."", "".MYSQL_USER."", "".MYSQL_PASS."") or die(mysql_error());
mysql_select_db("".MYSQL_DB."",$conn) or die(mysql_error());
$sql = "SELECT * FROM test";
$res = mysql_query($sql);
assuming it connects to the database correctly, that error always occurs for me when I have a table typed wrong. Make sure the table 'test' actually exists.
'test.test' means 'table with name 'test' located in database with name 'test''
Using this syntax you can select data from tables located in different databases by single query (using joins), assuming that you have enough privileges to access those other databases.
Your error message shows quite clearly that a table that you try to select from does not exist. In other words, there is no table 'test' in the 'test' database.