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

前端 未结 2 1607
不思量自难忘°
不思量自难忘° 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'];
        }
    

提交回复
热议问题