Jump to content
MakeWebGames

Cannot connect to Database.


General Doom
 Share

Recommended Posts

Hey all, i've not coded in awhile, and im embaressed to post this, but for the life of me I cannot find the problem.

Im creating a site but cannot get it to connect to the database, heres a sample script:

 

<?php
include_once 'db_connect.php';
$fetch=mysql_query("SELECT * FROM users WHERE id='$1'");
$info = mysql_fetch_object($fetch);


echo "$fetch->firstname";
echo "$info->firstname";
?>

 

It just displays nothing, the mySQL is scorrect (as far as I can tell) and my db_connect has all the correct info.

Please help!

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...