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.

Link to comment
Share on other sites

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.