mmarif4u Posted May 10, 2007 Share Posted May 10, 2007 R u tried this: <?php ?> instead of this: <? ?> Other what is the specific error u get. Link to comment https://forums.phpfreaks.com/topic/50638-solved-my-script-will-not-connect-to-the-database-must-be-error-in-code/page/2/#findComment-249591 Share on other sites More sharing options...
runnerjp Posted May 10, 2007 Author Share Posted May 10, 2007 yes tried it all i got is "Couldn't select database." when there is no spelling mistakes and i use my database for many other things Link to comment https://forums.phpfreaks.com/topic/50638-solved-my-script-will-not-connect-to-the-database-must-be-error-in-code/page/2/#findComment-249598 Share on other sites More sharing options...
per1os Posted May 22, 2007 Share Posted May 22, 2007 for one, put single quotes around the db name. <?php $db = mysql_select_db('runnerse_profiles') or die("Couldn't select database."); ?> and two try adding the resource link http://us2.php.net/mysql_select_db , IE: <?php $conn = mysql_connect("localhost", "user", "pass") or die("Couldn't connect."); $db = mysql_select_db('runnerse_profiles', $conn) or die("Couldn't select database."); $sql = "SELECT * FROM $tbl_images WHERE image_id = $auth[member_id] AND default_pic = \"yes\""; $result = mysql_query($sql,$conn) or die("Couldn't execute query."); ?> See what happens. If nothing than there may be something wrong with the database connection, although everything seems right. Also make sure you are not referring to a tablename in the mysql_select_db part instead of the actual database name. Link to comment https://forums.phpfreaks.com/topic/50638-solved-my-script-will-not-connect-to-the-database-must-be-error-in-code/page/2/#findComment-258718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.