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 }?>

Recommended Answers

All 6 Replies

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 ..

widout the end dot ..

try this:

$sqlquery = "SELECT email FROM userdetails WHERE email='".$_POST['email']."'";

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.