hi frens..
i have this piece of code, which is not working the way i thot it would. i want to check if the $key exists in array $rowid, where $key also comes from database.
lets say, key exists for the 1st iteration (it prints exist), but if key exists for 2nd and further iteration it doesnt print. why is it happening like this?? is there any other way i could do this? where am i going wrong??
foreach($_POST['rowid'] as $temp)
{
$rowid[]=$temp;
}
for($i=0;$i<count($rowid);$i++)
{
echo "rowid=".$rowid[$i]."<br>";
}
$query1="select id from purchase_order_detail where purchase_order_id='".$id."'";
result1 = mysql_query($query1);
$key=0;
while($row1 = mysql_fetch_array($result1))
{
$key = $row1['id'];
echo "key=".$key."<br>";
if((array_key_exists($key, $rowid)))
{
echo "key exists"."<br>";
}
}
it would be very helpful, if you could go thru the code an shed some light on how to solve this issue.
thanks