Showing results for 
Search instead for 
Did you mean: 

Any PHP specialists among you?

Posts: 28
Registered: 07-10-2007

Any PHP specialists among you?

Hello everyone.
I have the greatest trouble getting to my MySQL database via PHP.
Consider the following program:

<title> Our List of Jokes </title>
// Connect to the database server
$dbcnx = @mysql_connect('', 'jazzmusic', '*****');
if (!$dbcnx) {
die( '<p><b>Unable to connect to the</b> ' .
'<b>database server at this time.</b></p>' );
// Select the jokes database
if (! @mysql_select_db('jokes') ) {
die( '<p>Unable to locate the joke ' .
'database at this time.</p>' );
<p> Here are all the jokes in our database: </p>
<blockquote><b><font color="#00FF0F">
// Request the text of all the jokes
$result = @mysql_query('SELECT JokeText FROM jokes');
if (!$result) {
die('<p>Error performing query: ' . mysql_error() .
// Display the text of each joke in a paragraph
while ( $row = mysql_fetch_array($result) ) {
echo('<p>' . $row['JokeText'] . '</p>');
// Publishing MySQL Data on the Web

When I run this on my system using Abbyss Web Server and using "localhost" as hostname, it works perfectly.
However, when I use the uploaded jokelist_online.php form, either, after entering
my download window opens and tells me to download jokelist_online.php, or in the best case the page runs partly and gives me : "Unable to connect to the database server at this time.
In the online version, I have also tried to replace the hostname "" by "localhost", but no change.
Like I said, it works perfectly when I run it on my system.
Any ideas anyone?

Thank you.
Merry Xmas and Happy New Year,
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Any PHP specialists among you?

Duplicate - answered here
Community Veteran
Posts: 6,983
Thanks: 8
Registered: 10-04-2007

Any PHP specialists among you?

Thanks Peter


Please dont spam the forums.
There is no need to post the same thing in more than one part of the boards.

Topic locked