Perl Monk, Perl Meditation | |
PerlMonks |
Re: Using variables within a mysql queryby hesco (Deacon) |
on May 11, 2008 at 20:30 UTC ( [id://685981]=note: print w/replies, xml ) | Need Help?? |
Try something like this:
Remember: single quotes give you a literal, double quotes interpolates included variables. Also, if this is untrusted user input you are manipulating (say the kind collected at a browser) you would be much safer to use bind variables, by replacing these two lines like so:
Note: I've never tried to feed a $sort_order as a bind variable and have no idea if that would work. But a few tests ought to let you know if it will. I do know that the rest of this should work, although I have not tested this code, leaving that to you. -- Hugh
if( $lal && $lol ) { $life++; }
In Section
Seekers of Perl Wisdom
|
|