Jump to content

Variable variable within mysql query?


morocco-iceberg

Recommended Posts

You do realize that if you used an array, the syntax would be easier to figure out and it would be quicker -

 

If $q is an array so that the values are $q[0], $q[1], $q[2], you would use '{$q[$counter]}' to reference them in the query.

Not to mention that setting or referencing an array variable is 3x faster than using a variable-variable. Also with arrays, you can use array functions, such as foreach() and count() so that you don't need to keep track of how many of or what the names of the variable-variables are.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.