mysql - insert to sql with php -
i know there lot of topics on side regarding problem seems i'm missing when it:
the code below :
mysql_select_db("person"); $query = "select * email email='$_post[email]' , cc='$_post[zip]"; $rs = mysql_query($query) or die(mysql_error()); if(mysql_num_rows($rs)>=1){ echo "blablabla"; } else { $sql="insert `email` (`email`, `cc`), values (`$_post[email]`, `$_post[zip]`)"; mysql_query($sql); echo "blablabla";
this error on page: "you have error in sql syntax; check manual corresponds mariadb server version right syntax utilize near ''' @ line 1"
thanks
i saw lot of error in query.try instead
$query = "select * email email='".$_post['email']."' , cc='".$_post['zip']."'"; //you need set quote before variable name of $_post
and also
$sql="insert `email` (`email`, `cc`) values ('".$_post['email']."','".$_post['zip']."')";
don't utilize backtick on values,backtick utilize table or column name same reserved or key word of sql
php mysql
No comments:
Post a Comment