Re: what is the point of prepare?
| From: | Per Jessen | Date: | Mon, 29 Oct 2007 13:32:12 +0000 |
| Subject: | Re: what is the point of prepare? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263776@lists.php.net to get a copy of this message | ||
Hulf wrote:
> 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);
It's a performance measure - by preparing sql statements, you save on
the parsing and the network traffic. Unless you're doing lots of
database transactions per second, I doubt if you'll notice it.
/Per Jessen, Zürich