s.fox
December 23rd, 2008, 02:04 PM
Hi,
I feel like I am going insane. What on earth is wrong with the script I posted below? The script dies because of the SQL I am trying to run. The database login credentials are correct, as is the SQL itself.
$email = "example@example.com";
$host="localhost";
$username="username";
$password="pass";
$db_name="databaseName";
$connection = mysql_connect("$host", "$username", "$password")or die("cannot connect");
$query="SELECT userEmail,userID,userPassword,userUserName FROM user WHERE user.userEmail =
'$email'";
$st=mysql_query($query, $connection) or die("died because of $query");
$recs=mysql_num_rows($st) or die("died because of recs");
$row=mysql_fetch_object($st) or die ("died because of row");
Really stuck and very confused. Can anyone spot what the problem is?
Many thanks, Ash R
I feel like I am going insane. What on earth is wrong with the script I posted below? The script dies because of the SQL I am trying to run. The database login credentials are correct, as is the SQL itself.
$email = "example@example.com";
$host="localhost";
$username="username";
$password="pass";
$db_name="databaseName";
$connection = mysql_connect("$host", "$username", "$password")or die("cannot connect");
$query="SELECT userEmail,userID,userPassword,userUserName FROM user WHERE user.userEmail =
'$email'";
$st=mysql_query($query, $connection) or die("died because of $query");
$recs=mysql_num_rows($st) or die("died because of recs");
$row=mysql_fetch_object($st) or die ("died because of row");
Really stuck and very confused. Can anyone spot what the problem is?
Many thanks, Ash R