about issues with objects in the mysqli extension library
Source: Internet
Author: User
About object issues in the Mysqli extension library
$mysqli _stmt= $mysqli->prepare ($sql);
The above prepare belong to the Mysqli_stmt class? Why directly with $mysqli->prepare? Two is all right.
That should be the truth.
$mysqli _stml=new mysqli_stmt ();
$stmt = $mysql _stmt->prepare ();
------Solution--------------------
Mysqli_stmt mysqli::p repare (String $query)
The definition in the manual can you find it?
It means that prepare belongs to the Mysqli class, the argument is a string type, and the return value is an instance of the Mysqli_stmt class.
------Solution--------------------
Explore
Still don't understand. Directly with this sentence $stmt= $mysqli->prepare ($sql); is equivalent to creating an object $stmt? But the object should be created with new. I can't understand this place. Just got the wrong call.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service