PHP Error on if statment -


this question has answer here:

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

also mysql removed in php 7 use pdo or mysqli instead.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -