If you're making just one insert; it's probably not the best
approach. However, if you're inserting multiple rows, benchmarks
have shown that preparing a statement and binding the params is
faster. Also, with mysqli, you can strictly define types for fields
and remove the step of validation -- so they say. I'd rather not try
{} catch{} a query and give an error on failure... so, I prepare the
data as I test its validity anyway.
Jeremy Mcentire
Ant Farmer
ZooToo LLC
On Oct 29, 2007, at 6:06 AM, Hulf wrote:
Hi,
Begining using the php5 mysql functions and want to know what is
the point of preparing/binding the data before I insert it?
$prep = $mysqli->prepare ("INSERT INTO cd (cdid,title,artist)
VALUES ('0',?,?)");
$prep->bind_param ('22',$title,$artist);
Ta,
R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php