Jump to content

[SOLVED] my script will not connect to the database :@--must be error in code


runnerjp

Recommended Posts

  • 2 weeks later...

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.