This is the code
<?php
include("global.php");
$username = mysql_real_escape_string(stripslashes($_POST["strUserName"]));
$password = md5(mysql_real_escape_string(stripslashes($_POST["strPassword"])));
$charid = mysql_real_escape_string(stripslashes($_POST["charid"]));
$quest = mysql_real_escape_string(stripslashes($_POST["strQuest"]));
$query = "SELECT * FROM wherei_users, wherei_characters WHERE wherei_users.username = '{$username}' AND wherei_users.password = '{$password}' AND wherei_characters.username = '{$username}' AND wherei_characters.Id = '{$charid}'";
$result = mysql_query($query);
$yesorno = (mysql_num_rows($result) == 0) ? 'NO' : 'YES';
if(empty($username) || empty($password) || empty($charid) || empty($quest) || $yesorno == "NO") {
$status="error";
$msg="InvalidData";
$actiontype="&actiontype=savequestdata";
$out=("$actiontype&status=$status&msg=$msg");
}
if ($yesorno = "YES") {
mysql_query("UPDATE wherei_characters SET strQuest = '{$quest}' WHERE username = '{$username}' AND id = '{$charid}'") or die(mysql_error());
$actiontype="&actiontype=savequestdata";
$status="success";
$out=("$actiontype&$status");
}
echo("$out");
?>
However, it always returns that the staus was success? When I go to my browser and just type the url, it returns this
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 '' at line 1
And when I set the values wrong on purpose it returns that the status is succesfull, you see that if ether $username,$password,$charid,$quest
is empty or that $yesorno
is NO
then it should echo &actiontype=savequestdata&status=error&msg=InvalidData
. No matter what I set the variables to, it returns `actiontype=savequestdata&sucess?