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
https://forums.phpfreaks.com/topic/1410-need-help-bad/
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
https://forums.phpfreaks.com/topic/1410-need-help-bad/#findComment-4677
Share on other sites

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.