Re: Quotes in querys

From: Date: Thu, 15 Jan 2009 18:21:16 +0000
Subject: Re: Quotes in querys
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-286450@lists.php.net to get a copy of this message
It is over head, but it caches the execution plan for multiple runs of the script. So different users with different data will use the same cached query on the database. Saving processing time. It also prevents SQL injection on the fly because you are indicating what data type each place holder will need to accept.
No, it's per session. http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html The scope of a prepared statement is the client session within which it is created. Other clients cannot see it.
Well he probably meant that the mysql server will cache the query and that is true. But I think that mysql uses the cache only if the query is the exact same... So it does no good in this case. -- Thodoris

« previous php.general (#286450) next »