Re: question about best practice for coding sql statements
| From: | Geoff Shang | Date: | Sat, 12 Nov 2011 22:09:58 +0000 |
| Subject: | Re: question about best practice for coding sql statements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-315661@lists.php.net to get a copy of this message | ||
On Sat, 12 Nov 2011, tamouse mailing lists wrote:
I'm curious how others feel about this. When I'm creating an SQL string, either for a non-prepared or prepared execution, I build it in a variable and then pass the variable to the query or prepare function. This lets me easily add something to view the SQL statement, and also if there's an error, emit the SQL statement.I do this. This means that when a user encounters an error, they can actually give you a meaningful error report which should reduce the time it takes to fix it by a considerable amount. Geoff.