Fatal error cropped: mysqli_stmt class object cannot be converted to string

I am new to PHP OOP, so this question should be pretty dumb. I cannot create a SQL query through PHP. I read the code many times, but I can’t find any discrepancies, and even the editor does not display any errors. I am using PHP 5.5.13, MYSQL 5.5.24 and APCHE Server 2.2.22.

Below is the code:

Test_signup.php

<!DOCTYPE HTML>
    <html>
        <head>
            <title>
            Test Sign Up
            </title>
        </head>
        <body>
                <form action = "Signup.php" method = "POST" name = "test_signup">
                Full Name: <input type = "text" name = 'full_name'>
                User Name: <input type = 'text' name = 'user_name'>
                Email: <input type = 'text' name = 'email_add'>
                <input type = "submit" name = "submit">
            </form>

        </body>
    </html>

Now go to Registration.php

<?php
$con = new mysqli('localhost', 'root', '', 'my_database');
      if ($con->connect_error)
      {
        echo 'Failed to connect' . $con->connect_error;
      }
      else
      {
        echo 'Connected';
        $stmt_chk_email = $con->prepare('SELECT * FROM `user_information` WHERE `Email` = ?');
        $stmt_chk_email->bind_param('s', $_POST['email_add']);
        echo $stmt_chk_email;
?>

When I try to run this code, I get an error message:

Mysqli_stmt class object cannot be converted to string

, , . , , SQL SELECT, . , . .

+3
1

echo $stmt_chk_email;

, , .

     $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 ;
  .....
+2

All Articles