Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 不';t返回精确值_Php_Jquery_Ajax - Fatal编程技术网

Php 不';t返回精确值

Php 不';t返回精确值,php,jquery,ajax,Php,Jquery,Ajax,电子邮件值通过以下方式从一个页面传递到另一个页面 $.ajax({ type:'post', url:'email.php', data:{email: email}, success:function(msg){ alert(msg); } }); $s显示电子邮件id。我回显了$echeck和$echk进行测试$echk不返回1 $s=$_POST['email']; echo $echeck="select emai

电子邮件值通过以下方式从一个页面传递到另一个页面

  $.ajax({
type:'post',
    url:'email.php',
    data:{email: email},
    success:function(msg){
    alert(msg);         
    }
 });
$s显示电子邮件id。我回显了$echeck和$echk进行测试$echk不返回1

  $s=$_POST['email'];
  echo $echeck="select email from register where email=".$_POST['email'];
  echo $echk=mysql_query($echeck);
  echo $ecount=mysql_num_rows($echk);

您在查询中提供了一个不带引号的字符串

尝试:


mysql\u real\u escape\u string
用于避免在
$\u POST['email']
中包含引号或更糟的内容时出现不好的情况。

您需要在sql查询中引用字符串值

echo $echeck="select email from register where email='".$_POST['email']."'";

不清楚您的问题是什么。那么#echk给出了什么?$echk在查询得到execute时返回1
echo $echeck="select email from register where email='".$_POST['email']."'";