What does a colon in a MySQL statement mean?
What does a colon in a MySQL statement mean?
------Solution--------------------
$db->bandvars (); Passing values
echo $check _query; Will know.
------Solution--------------------
Can look at the brochure PDO class
PHP Code
Prepare (' SELECT name, colour, calories from fruit WHERE calories <: calories and colour =: Colour '); $sth->bind Param (': Calories ', $calories, PDO::P aram_int), $sth->bindparam (': Colour ', $colour, PDO::P aram_str,); $sth Execute ();? >
------Solution--------------------
There is no other meaning in the notation, so that it differs from the syntax component of SQL
The Bindvars method associates the defined symbol with the actual variable.
------Solution--------------------
PHP code
example #1 Execute a prepared statement with named place Holders!--? php/* Execute A prepared statement by binding PHP variables */$calories =; $colour = ' red '; $sth = $dbh-- ->prepare (' SELECT name, colour, calories from fruit WHERE calories <: calories and colour =: Colour '); $sth->bi Ndparam (': Calories ', $calories, PDO::P aram_int), $sth->bindparam (': Colour ', $colour, PDO::P aram_str,); $sth- >execute ();? >example #2 execute a prepared statement with question mark placeholders the!--? php/* Execute a prepared statement by B Inding PHP Variables */$calories =; $colour = ' red '; $sth = $dbh--->prepare (' SELECT name, colour, calories from fruit WHERE calories <? and colour =? '); $sth->bindparam (1, $calories, PDO::P aram_int), $sth->bindparam (2, $colour, PDO::P aram_str, N); $sth Execute ();? >