PHP Error on if statment -
this question has answer here:
- php parse/syntax errors; , how solve them? 12 answers
i keep getting error:
php error message
parse error: syntax error, unexpected t_encapsed_and_whitespace, expecting t_string or t_variable or t_num_string in /home/a6941725/public_html/php/usersystem/signup.php on line 4
here code:
if (mysql_query("select * main username $_post['username']"); !== "$_post['username']") { $username = $_post['username']; }
i @ php can't figure out why not working!
you should try like,
$query = sprintf("select * main username '%s'", mysql_real_escape_string($_post['username']); $result = mysql_query($query);// gives result while ($row = mysql_fetch_array($result)) { if ($row['username'] !== $_post['username']) { // remove quotes post field $username = $_post['username']; break;// if both not same break } }
Comments
Post a Comment