Hi, I have Apache 2, PHP 5 and MySQL 4.1 installed on an XP pro box. I have created a new database 'ijdb' with a single table 'joke' and have entered data into two of the three fields in the table.
I can access the database / tables / data from a command prompt, and I can access and extract the data with an odbc_connect. However, when I try to connect through a mysql_connect connection type I either receive a 'Unable to connect to the database server at this time.' error message - which is my default error message, or, I receive a blank window in IE / Mozilla / Opera etc and no error messages (just a blank screen). I have attached the code I am using below - hoping that someone can see where I am going wrong and will point me in the right direction. I have tried removing the @ from the file and this has no effect - interesting?! The error logs do not reveal anything that indicates a missing table / field. I wonder if anyone has any ideas ? Cheers, Mike <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Our List of Jokes</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', 'MyPassword'); if (!$dbcnx) { echo '<p>Unable to connect to the ' . 'database server at this time.</p>' ); exit(); } // Select the jokes database if ([EMAIL PROTECTED]('ijdb')) { exit('<p>Unable to locate the joke ' . 'database at this time.</p>'); } ?> <p>Here are all the jokes in our database:</p> <blockquote> <?php // Request the text of all the jokes $result = @mysql_query('SELECT joketext FROM joke'); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } // Display the text of each joke in a paragraph while ($row = mysql_fetch_array($result)) { echo '<p>' . $row['joketext'] . '</p>'; } ?> </blockquote> </body> </html>