Jump to content

Recommended Posts

Hey my code works properly. But the database connection is failing to find the the table. I am using the code below and the echo message ''error finding database table'' the name of the table is fine. ANy suggestion

 

<?php
mysql_select_db("albums",$con) or die('Error finding database table');
$sql = "INSERT INTO photos values(0, '$_POST[photo_title]', '$_POST[photo_desc]', NOW(), '$image_location', '$thumb_location', $_POST[album_id])";
$result = mysql_query($sql, $dbcnx) or die("Error inserting record(s) into the database: " . mysql_error());
	if ($result){
		echo("Images successfully converted and stored! <br />Click <a href='../admin'>here</a> to continue.");
	}
}

?>

Add mysql_errror into the die function:

mysql_select_db("albums",$con) or die('Error finding database: '. mysql_error());

 

Have you established a connection to mysql yet? I do not see a call to mysql_connect.

Have you add mysql_error as i suggested earlier (above) to this line:

mysql_select_db("albums",$con) or die('Error finding database table');

 

Adding mysql_error to the die function will give you more information.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.