mysql - Converting this DB Queries to php PDO -


Need help in getting these two questions in PDO

PHP code:

  

if ($ that! = "") {$ Sql ​​= "SELECT id, title, itemurl from iwbf_vault WHERE UID = '". $ Joe "Order by Paid DESC LIMIT $ limit_start, $ items_per_page ';} and {$ sql =" SELECT id, title, itemurl, iwbf_vault ORDER pudt DESC LIMIT $ limit_start, $ items_per_page ";}

I will write it like this:

  // You probably have this $ pdo -> Set Attribute (PDO :: ATTR_ERRMODE, PDO :: ERRMODE_EXCEPTION); $ value = array (); $ Sql ​​= "SELECT id, title, itemurl from iwbf_vault where true"; if ($ Which) {$ sql. = "And UID =?"; $ Value [] = $ Joe;} $ Sql. = "ORDER BY PUDT DESC LIMIT ?, $ value [] = $ limit_start; $ value [] = $ Items_per_page; $ Stmt = $ pdo-> Ready ($ sql); $ Stmt-> execution ($ value);  


Comments