How to connect to MYSQL database, useing php?

Nick

New member
hi there people.

i'm kinda new at php, but i will explain the best i can. okay

so i am making a user log in
and at this point i am stuck, and cannot go any farther.


i'm not 100% sure what i am doing so wrong but hopefully someone can pick out my mistakes.

my code to connect to my (mysql)

<?php

$username = $_POST['username'];
$password= $_POST['password'];


if ($username&&$password)
{


$connect = mysql_connect ("localhost","root","") or die ("Couldn't connect!");
mysql_select_db ("login") or die ("Couldn't find db!");



alright so thats the code i have been trying, and i've tried differfrent ways , replaceing the host/user/password

but it's not connecting, it is just saying

Parse error: syntax error, unexpected T_STRING in /home/************/public_html/login.php on line 11

}
else
die ("Please enter a username and a password!");


?>
sorry i forgot to use the spell checker.


and also , i at the very bottom i did not mean to have the extra coding.
 
Back
Top