Jump to content

NEED HELP BAD!


JDWSLIPKNOT

Recommended Posts

I need to know how to connect to a mysql database. I was working on the membership tutorial on the site and when it says to make a db.php I got stuck this is what i got though


<?

$db_name = "DBNAME"

$connection = @mysql_connection("localhost", "USERNAME", "PASSWORD")

or die(mysql_error());

$db = @mysql_select_db($db_name, $connection) or die(mysql_error());

?>

 

And this is what I get from that

 


Parse error: parse error in /home/virtual/site37/fst/var/www/html/members/db.php on line 4



Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/virtual/site37/fst/var/www/html/members/register.php on line 52



Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/virtual/site37/fst/var/www/html/members/register.php on line 53

No Database Selected

Can anyone help me

Link to comment
Share on other sites

did you not see the code there? it should be included at the end of the tut. even so, i\'ll be a nice guy:

 

[php:1:134af6a8f8]

<?

/* Database Information - Required!! */

/* -- Configure the Variables Below --*/

$dbhost = \'localhost\';

$dbusername = \'xxxxxx\';

$dbpasswd = \'xxxxxxx\';

$database_name = \'xxxxxxx\';

 

/* Database Stuff, do not modify below this line */

 

$connection = mysql_pconnect(\"$dbhost\",\"$dbusername\",\"$dbpasswd\")

or die (\"Couldn\'t connect to server.\");

 

$db = mysql_select_db(\"$database_name\", $connection)

or die(\"Couldn\'t select database.\");

 

// checkuser function

 

function session_checker(){

if(!session_is_registered(\'first_name\')){

include \'login_form.html\';

exit();

}

}

 

?>

[/php:1:134af6a8f8]

 

don\'t worry about the second part of that (the session checker function)just yet.

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.