mysqli binding of values and variables (Zend Cert)
I have came across this MySQLI question in my zend studies recently, hope someone can help......
Consider the following code snippet:
Assuming this snippet is a smaller part of a correctly written script, what actions must occur in place of the ????? in the above code snippet to insert a row with the following values: 10, 20.2, foo, string ?
$query = "INSERT INTO mytable
(myinteger, mydouble, myblob, myvarchar)
VALUES (?, ?, ?, ?)";
$statement = mysqli_prepare($link, $query);
/* The variables being bound to by MySQLi
don't need to exist prior to binding */
$myinteger, $mydouble, $myblob, $myvarchar);
/* ???????????? */
/* execute the query, using the variables as defined. */
The available options are:
1. A transaction must be begun and the variables must be assigned
2. Each value must be assigned prior to calling mysqli_bind_param(), and thus nothing should be done
3. Use mysqli_bind_value() to assign each of the values
4. Assign $myinteger, $mydouble, $myblob, $myvarchar the proper values
The examples on the manual page look very similar to the question...perhaps you should look there for assistance?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread