adam291086 Posted September 26, 2007 Share Posted September 26, 2007 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."); } } ?> Link to comment https://forums.phpfreaks.com/topic/70803-solved-locating-a-table-to-input-information-to/ Share on other sites More sharing options...
wildteen88 Posted September 26, 2007 Share Posted September 26, 2007 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. Link to comment https://forums.phpfreaks.com/topic/70803-solved-locating-a-table-to-input-information-to/#findComment-355984 Share on other sites More sharing options...
adam291086 Posted September 26, 2007 Author Share Posted September 26, 2007 yeah i have, at the top of the code i include a php file with the connection in. It all works as i have other pages calling on that same file to retrive information Link to comment https://forums.phpfreaks.com/topic/70803-solved-locating-a-table-to-input-information-to/#findComment-355986 Share on other sites More sharing options...
wildteen88 Posted September 26, 2007 Share Posted September 26, 2007 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. Link to comment https://forums.phpfreaks.com/topic/70803-solved-locating-a-table-to-input-information-to/#findComment-355991 Share on other sites More sharing options...
adam291086 Posted September 26, 2007 Author Share Posted September 26, 2007 Hey i added in the error statement. Still get the same result. There is no error with the sql code apart from it cant find the table. Link to comment https://forums.phpfreaks.com/topic/70803-solved-locating-a-table-to-input-information-to/#findComment-355996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.