This may be a little elementary for some, but in something like the following statement what would happen if the string was an integer (e.x 007 as in the movie):
$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
- If colour was '007' would PDO::PARAM_STR, still work?
- What is int 12 for? does it refer to the length of (colour & $colour)?
- Is it's purpose to maximize the filter? (only strings of 12 get through?)
Thanks guys, still working on deciphering manual (new to PHP) but so far don't see specifics on this.
Complete statement here.
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
FROM fruit
WHERE calories < :calories AND colour = :colour');
$sth->bindParam(':calories', $calories, PDO::PARAM_INT);
$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
$sth->execute();