Re: what is the point of prepare?

From: Date: Mon, 29 Oct 2007 13:33:55 +0000
Subject: Re: what is the point of prepare?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-263777@lists.php.net to get a copy of this message
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.


« previous php.general (#263777) next »