php - sql query generated by user selects -


i begginer , can’t find tutorial or example of dynamic sql query generated user selects. suppose have checkboxes or select fields 5 colors , 5 clothes types. automatically search example “blue” “t-shirt” ,do have pass using ajax values of “colour” , “type” search.php page , , create sql query

select * table colour=”request_[‘colour’]”  , type=”request_[‘type’]” ? 

is correct procedure ?

i pass values through post/get ajax or straight form. it's choice.

but php code be.

<?php $colour = htmlspecialchars(mysql_real_escape_string($_post['colour'])); //or $_get $type = htmlspecialchars(mysql_real_escape_string($_post['type'])); //or $_get mysql_query("select * `table` `colour`='".$color."' , `type`='".$type."'"); 

i suppose way of doing it.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -