I pass an array of questions nid from form to function
$childs = Array(
200=>1,
201=>1,
202=>1,
203=>1);
function make_child_questions($childs)
{
ksort($childs);
$parent = key($childs);
foreach ($childs as $key => $c)
{
if ($key != $parent)
{
db_query("update question set parent_que_nid = $parent where (nid = $key AND parent_que_nid = 0)");
print_r($child_condition.',Affected : '.mysql_affected_rows());
}
}
}
This function will make nid = 201,202 and 203 childs of nid=200, it displays that three rows affected but on of 201,202,203 does not actually updated in table,
Every time this functions calls with same parameter randomly one nid from 201,202 and 203 not actually updated in table even function returns that rows affected.
When i run query which is returned from function in phpmyadmin then it works and rows affected.
What will b the problem? plz help
Thanks