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 discrepancy and even the editor isn't displaying any error. I'm using PHP 5.5.13, MYSQL 5.5.24 and APCHE Server 2.2.22.
Following 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 coming to the Signup.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 trying to run this code, I'm receiving an error:
Object of class mysqli_stmt could not be converted to string
Of course the original query is much larger than posted here. I've edited the later part of the query as I figured out that the problem resides within the SQL "SELECT" statement but I'm unable to figure it out. Kindly help me on this.
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…