Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.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错误可以';我想我不知道这和SQL有关_Php_Sql_Postgresql - Fatal编程技术网

PHP错误可以';我想我不知道这和SQL有关

PHP错误可以';我想我不知道这和SQL有关,php,sql,postgresql,Php,Sql,Postgresql,好的,错误显示在这个代码的某个地方 if($error==false) { $query = pg_query("INSERT INTO chatterlogins(firstName, lastName, gender, password, ageMonth, ageDay, ageYear, email, createDate) VALUES('$firstNameSignup', '$lastNameSignup', '$genderSignup', md5('$

好的,错误显示在这个代码的某个地方

    if($error==false) {

        $query = pg_query("INSERT INTO chatterlogins(firstName, lastName, gender, password, ageMonth, ageDay, ageYear, email, createDate) VALUES('$firstNameSignup', '$lastNameSignup', '$genderSignup', md5('$passwordSignup'), $monthSignup, $daySignup, $yearSignup, '$emailSignup', now());");
        $query = pg_query("INSERT INTO chatterprofileinfo(email, lastLogin) VALUES('$email', now())";);
        $_SESSION['$userNameSet'] = $email;
        header('Location: signup_step2.php'.$rdruri);

    }
有人看到我做错了什么吗???对不起,我说的不具体,但我已经盯着它看了10分钟了,我想不出来

$query = pg_query("INSERT INTO chatterprofileinfo(email, lastLogin) VALUES('$email', now())";);
靠近结尾的分号(
)放错了位置。它应该在字符串中:

$query = pg_query("INSERT INTO chatterprofileinfo(email, lastLogin) VALUES('$email', now());");

在您的示例中,monthSignup、daySignup和yearSignup没有被引用。

当查询失败时,pg_query()返回false。返回上次操作的错误消息。
希望所有这些变量-$firstNameSignup,$lastnesignup,$genderSignup。。。除了$passwordSignup-已通过正确转义

if($error==false){
$query=”
插入
喋喋不休
(
名、姓、性别、密码、,
ageMonth、ageDay、ageYear、电子邮件、createDate
)
价值观
(
“$firstNameSignup”、“$lastnesignup”、“$genderSignup”、md5(“$passwordSignup”),
$monthSignup,$daySignup,$yearSignup,$emailSignup',now()
)
";
echo“Debug:query=”,htmlspecialchars($query),“”;
$rc=pg_query($query);
如果(!$rc){
die('pg_查询失败:'.htmlspecialchars(pg_last_error());
}
$query=”
插入
chatterprofileinfo
(电子邮件,最后登录)
价值观
(“$email”,now())
";
echo“Debug:query=”,htmlspecialchars($query),“”;
$rc=pg_query($query);
如果(!$rc){
die('pg_查询失败:'.htmlspecialchars(pg_last_error());
}
$\会话['$userNameSet']=$email;
标题('Location:signup_step2.php.$rdruri);
}
if($error==false) {
  $query = "
    INSERT INTO
      chatterlogins
      (
        firstName, lastName, gender, password,
        ageMonth, ageDay, ageYear, email, createDate
      )
      VALUES
      (
        '$firstNameSignup', '$lastNameSignup', '$genderSignup', md5('$passwordSignup'),
        $monthSignup, $daySignup, $yearSignup, '$emailSignup', now()
      )
  ";
  echo '<pre>Debug: query=', htmlspecialchars($query) , '</pre>';
  $rc = pg_query($query);
  if ( !$rc ) {
    die('pg_query failed: ' . htmlspecialchars(pg_last_error()) );
  }


  $query = "
    INSERT INTO
      chatterprofileinfo
      (email, lastLogin)
    VALUES
      ('$email', now())
  ";
  echo '<pre>Debug: query=', htmlspecialchars($query) , '</pre>';
  $rc = pg_query($query);
  if ( !$rc ) {
    die('pg_query failed: ' . htmlspecialchars(pg_last_error()) );
  }

  $_SESSION['$userNameSet'] = $email;
  header('Location: signup_step2.php'.$rdruri);
}