I’m currently facing a problem in mysql. I have this first id that i got from jquery which is like 398(from user1) and so on incrementing till 700 with other users input too. i managed to pass the grabbed value from jquery to the mysql query. But, here is the problem i need to increment the value of the id from 398 to the next id which is 400(the next id is randomly 405) i can’t seem to find a good soln on the internet after googling. The soln’s are too abstract for me. So, far, couldn’t understand how i can select from updates table the correct next incrementing id pertaining to that user1&user2. is, there a way to do it in mysql with the jquery value which isn’t incrementing, using php is also good for me.
here is the mysql query:
public function totalUpdates($friend,$session,$update_id1,$update_id2, $load) {
try{
$sql2="SELECT distinct update_id,update_body,time,title,user_id_u,account_name,author,data FROM updates where author in (:friend,:session) and update_id not in(:update_id1, :update_id2) order by time desc limit $load,2";
$stmth= $this->_db->prepare($sql2);//Check here syntax of $db
$stmth->bindValue(":session",$session);
$stmth->bindValue(":friend",$friend);
$stmth->bindValue(":update_id1",$update_id1);
$stmth->bindValue(":update_id2",$update_id2);
$stmth->execute();
return $stmth->fetchAll();
} catch (PDOException $ei){
echo $ei->getMessage();
}
}