Hi .. I'm not so experienced with php .. I'm getting this error on the bolded line .. Can neone help me figure it out ..

Dinesh Ramchandani

$con = mysql_connect("localhost","username","password");
if (!$con)
  die('Could not connect: ' . mysql_error());
$db_selected = mysql_select_db('lasagnia_user', $con);
if (!$db_selected) {
    die ('Can\'t use user : ' . mysql_error());
if (isset($_REQUEST['Button'])) 
[B]$sqlquery = “SELECT email FROM userdetails WHERE email=(’".$_POST[email]."’)”;[/B]
$result = mysql_query($sqlquery,$con) or die(“Query died: email”);
$num = mysql_num_rows($result); 
if($num > 0) 
$sql = “SELECT email FROM userdetails WHERE email=’$_POST[email]’ AND pass=md5(‘$_POST[pass]’)”;
$result2 = mysql_query($sql,$con) or die(“Query died: pass”);
$num2 = mysql_num_rows($result2); 
if($num2 > 0) //password matches 
$_SESSION[‘logname’] = $_POST[‘email’]; 
//header(“Location: SecretPage.php”); 
else // password does not match 
$message_1=”The Login Name, ‘$_POST[email]’
exists, but you have not entered the
correct password! Please try again.”;
$email = strip_tags(trim($_POST[email]));
} // end if $num > 0
elseif($num == 0) // login name not found 
$message_1 = “The User Name you entered does not
exist! Please try again.”;


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Customer Login Page</title></head>
<div id='wrapper'> 
<div id='login'>
<fieldset style=’border: 2px solid #000000’>
<legend><b>Login Form</b></legend>
<div id=’field1’>
<label ><b>Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input id=’email’ name=’email’ type=’text’
value=’ ’ size=’20’ maxlength=’255’ />
<div id=’field2’>
<label ><b>Password:</label>
<input id=’pass’ name=’pass’ type="password"
 size=’20’ maxlength=’255’ />
<input type='submit' name='Button' 
style=’margin-left: 45%; margin-bottom: .5em’
value='Login' />
<p style=’text-align: center; margin: 1em’>
If you already have an account, log in.</p>
<p style=’text-align: center; margin: 1em’>
If you do not have an account, <a href="/regform/index.php">Register now.</a></p>
<?php }?>
6 Years
Discussion Span
Last Post by rcollins

You use three symbols for closing quoting marks” " and ' there are really only two in programming " and ' . Sometimes in your code you open with” and close with» that will cause PHP not to know what to do


u mean

$sqlquery = “SELECT email FROM userdetails WHERE email=’$_POST[email].’”;

i tried almost everything .. But no help ..


still the same error .. is there a problem with above lines ?


You need to tell your form element to use post as it's method. <form method="post"> Either that or use the $_REQUESTor $_GET variables

Edited by rcollins: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.