Jump to content

Archived

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

jeva39

Problem with sql query

Recommended Posts

Please what is the correct syntax for include a variable in a sql query like this:

$tipo=_GET['clas']

$sql = 'select id,clase,tema,ritmo,autor,arreglo,fecha,kar,nuevo,archivo from temas where CLASE like [b]I NEED INCLUDE $tipo HERE [/b] order by ' . $sort;

Thanks in advanced....

Share this post


Link to post
Share on other sites
$tipo= $_GET['clas'];
$sql = "select id,clase,tema,ritmo,autor,arreglo,fecha,kar,nuevo,archivo from temas where CLASE like '" . $tipo . "' HERE order by " . $sort;

you may want to use '%" . $tipo . "%'

I still concatenate vars in a double quoted string so that I can see them a little easier in my chosen editor you don't have to for it to work but its just a habit (i think a good one) of mine

Share this post


Link to post
Share on other sites
Thanks very much ToonMariner! All working fine  :) My problem is that I work many time with ASP and ASP.NET and I still confused with the PHP syntax. Really, thanks..

Jorge, Panamá

Share this post


Link to post
Share on other sites

×

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.