Catchable fatal error: Object of class mysqli_stmt could not be converted to string

前端 未结 2 1606
不思量自难忘°
不思量自难忘° 2020-12-07 03:39

I\'m new to PHP OOP so this question must be quite dumb. I\'m unable to create an SQL query through PHP. I\'ve read the code many times but I\'m unable to find any discrepa

相关标签:
2条回答
  • 2020-12-07 03:47
            $stmt_chk_email = $con->prepare('SELECT `column` FROM `user_information` WHERE `Email` = ?');
            $stmt_chk_email->bind_param('s', $_POST['email_add']);
            $stmt_chk_email->execute();
            $stmt_chk_emeil->store_result();
            $stmt_chk_email->bind_result($check_email);
            $stmt_chk_email->fetch();
            echo $check_email;
    

    OR

        $stmt_chk_email = $con->prepare('SELECT * FROM `user_information` WHERE `Email` = ?');
        $stmt_chk_email->bind_param('s', $_POST['email_add']);
        $stmt_chk_email->execute();
    
        $result = $stmt_chk_email->get_result();
    
        if($result->num_rows == 1)
        {
             $result = $result->fetch_array();
             echo $result['column_name'];
        }
    
    0 讨论(0)
  • 2020-12-07 03:50

    you cant echo this

    echo $stmt_chk_email;

    you maybe want to echo this

         $stmt_chk_email = $con->prepare('SELECT column1 ,column2,... FROM `user_information` WHERE `Email` = ?');
         $stmt_chk_email->execute();
         $stmt_chk_email->store_result();
         $stmt_chk_email->bind_result($column1 ,$column2,.....);
         $stmt_chk_email->fetch();
      echo $column1;
      echo $column2 ;
      .....
    
    0 讨论(0)
提交回复
热议问题