I need help. I can not find information. There is a table shop_category row server - has the id of servers (in which the category should be displayed). I deduce a category by such code

$category_items = $mysqli->query("SELECT * FROM shop_category WHERE server ='".htmlspecialchars(addslashes($_POST['idserver']))."' ORDER BY id ASC "); 

server is a 1.2-server type. How to make the output work (now it does not output if you specify 1.2, and so on - only single numbers)

    1 answer 1

    Use the ID listing, via IN

     $category_items = $mysqli->query("SELECT * FROM shop_category WHERE server IN(3,16) ORDER BY id ASC ") 
    • An example can throw off? Where to use? server = '". htmlspecialchars (addslashes ($ _ POST [' idserver ']))."' - Kohl
    • $ category_items = $ mysqli-> query ("SELECT * FROM shop_category WHERE server IN (". htmlspecialchars (addslashes ($ _ POST ['idserver']))). ") ORDER BY id ASC"); So? - Kohl
    • displays only on the first server (1) although it costs 1.2 - Kohl
    • You mysqli-> query will of course output 1 result, all you need to do after the query is to fetch_array or fetch_object - user190134
    • More precisely, its query will display the result, and give the object, and this object is already distilled into fetch - user190134