jeva39 Posted September 4, 2006 Share Posted September 4, 2006 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.... Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 4, 2006 Share Posted September 4, 2006 $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 Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 4, 2006 Share Posted September 4, 2006 sanitise user input. Quote Link to comment Share on other sites More sharing options...
jeva39 Posted September 4, 2006 Author Share Posted September 4, 2006 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á Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.