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. Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.