views:

49

answers:

1

If a variable will always be a number, is there a performace loss by putting it in inverted commas?

for example

"SELECT prod.product_name FROM prod WHERE prod.id = '$id'";
+1  A: 

No, you won't have any performance loss by putting them inside inverted commas. But do take care of sql injections in such kind of queries. Also note that performance means many things, you've to be specific. Generally, it works fine.

1s2a3n4j5e6e7v
+1: Single quote values against columns with numeric data types have implicit conversion performed -- means you don't have to use CAST.
OMG Ponies