View Full Version : Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';'
zee000
02-11-2010, 03:43 PM
can any one check what is the wrong in this code...
<?php
include 'conifig.php';
echo $Loginname='$_GET["Loginname"];
$pass=$_GET["pass"];
$query = "SELECT * FROM table WHERE Loginname="$Loginname"";
$result = mysql_query($query, $con);
if ($result['flag']==0)
{
$sql="UPDATE table SET flag=1 WHERE Loginname=$Loginname";
echo "hi";
//header('Location:login.html');
}
else
{
echo "your activation is incomplete please activate your link by activation link";
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
?>
any suggestions please
Schmoopy
02-11-2010, 04:05 PM
You've put an apostrophe before the get variable, making PHP think it's a string. Syntax highlighting would have helped you see this very easily:
<?php
include 'conifig.php';
echo $Loginname= $_GET["Loginname"];
$pass=$_GET["pass"];
$query = "SELECT * FROM table WHERE Loginname= '" . $Loginname . "' ";
$result = mysql_query($query, $con);
if ($result['flag']==0)
{
$sql="UPDATE table SET flag=1 WHERE Loginname=$Loginname";
echo "hi";
//header('Location:login.html');
}
else
{
echo "your activation is incomplete please activate your link by activation link";
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
?>
Also you didn't put the variable in a string in the query.
zee000
02-12-2010, 09:53 AM
hi this is not working i have tried it
i am getting an error that
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''lkjhgfsjd' at line 1.
to get an idea i will send u my before page code plz check it .
<?php
include 'conifig.php';
$pass=md5($_POST[password]);
$sql="INSERT INTO table
VALUES ('','$_POST[firstname]','$_POST[lastname]','$_POST[middlename]','$_POST[radio]' ,'$_POST[loginname]','$pass',
'$_POST[dateofbirth]','$_POST[address1]','$_POST[address2]','$_POST[state]','$_POST[city]','$_POST[country]','$_POST[pincode]','$_POST[mailid]','$_POST[answer1]','$_POST[answer2]','$_POST[answer3]','')";
if (mysql_query($sql,$con))
{
$to = $_POST[mailid];
$subject = "Activation conformation";
$message = " Hello!
Your Account Has Been Created With The Following Login Credentials
Login Name ='$_POST[loginname]'
Password ='$pass'
thank u for siging up please click the following link to activate your account
http://pro.server.com/zee_000/verifyregister.php?Loginname='$_POST[loginname]' & password='$pass'";
$from = "something@something.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
}
else
{
die('Error: ' . mysql_error());
}
echo"1 Record Is Added";
mysql_close($con);
?>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.