How to set the delay between update queries in Mysql so that every query get executed succesfully?
Posted
by
OM The Eternity
on Stack Overflow
See other posts from Stack Overflow
or by OM The Eternity
Published on 2011-02-28T07:12:53Z
Indexed on
2011/02/28
7:25 UTC
Read the original article
Hit count: 111
Hi All
I have to the Update query mulitple times for different parameters using for loop in my PHP Script, now the problem Is Whenever I do it, only my last query get executed, all the previous queries seems to be skipped. the loop goes like this:
foreach($cntrlflagset as $cntrlordoc => $cntrlorflag){
for($t=0;$t<count($cntrlorflag);$t++){
$userlvl = "controller";
$docflag = 1;
$postfix = "created";
$createdoc->updatedocseeflags($cntrlorflag[$t],$docflag,$cntrlordoc,$postfix,$userlvl);
$docflag = 2;
$postfix = "midlvl";
$createdoc->updatedocseeflags($cntrlorflag[$t],$docflag,$cntrlordoc,$postfix,$userlvl);
}
}
Here, the called function
$createdoc->updatedocseeflags($cntrlorflag[$t],$docflag,$cntrlordoc,$postfix,$userlvl);
Contains the Update query:
$query = "UPDATE tbl_docuserstatus SET";
//if($flag != ""){
$query .= " docseeflag_".$postfix." = '".$flag."'";
//}
$query .= " WHERE doc_id = '".$doc_id."' AND user_id = '".$user_id."'";
if($userlvl == "midlvl"){
$query .= " AND doc_midlvluser = '1'";
}elseif($userlvl == "finallvl"){
$query .= " AND doc_finallvluser = '1'";
}elseif($userlvl == "creator"){
$query .= " AND doc_creator = '1'";
}elseif($userlvl == "controller"){
$query .= " AND doc_controller = '1'";
}elseif($docarchive == 1){
$query .= " AND doc_controller = '1'";
}
So could some one tell me,
How to set the delay between update queries in Mysql so that every query get executed succesfully?
Thanks In Advance
© Stack Overflow or respective owner