I have a pagination in my webpage. So I want to add a line to my query if I have a post from pagination:
$q="";
if(isset($_POST["inpi"])){
$in = $_POST["inpi"];
if(is_numeric($in)){
$q = "and c.id < '$in'"; // add this to mysql
}
else{die("something is wrong!");}
}
So I can't use prepare statments here.
select k.user, c.id, c.from, c.sent, c.message, c.recd from chat c
inner join cadastro k on c.from=k.id
where `from`=? and `to`=? $q
notice the $q variable, it will have no value if post is empty or the and c.id < '$in'.
is it secure enought?
arrayused to hold the values at the same time.mysqliisn't impossibly hard.mysqlithat could be adapted.