Help on array
| From: | Wee Chua | Date: | Fri, 22 Dec 2000 20:09:22 +0000 |
| Subject: | Help on array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31620@lists.php.net to get a copy of this message | ||
Hi all,
Could anyone help me to correct my codes? I would like to have part 1 to
produce same result as part 2 does. My purpose is to simply the codes. I
have errors inside Part1. For some reason, Part1 wouldn't produce variabe
$FKMET_ID1, $FKMED_ID2, and so on. Thanks for any helps!
Part1
$numrows = @mysql_num_rows($result[$rs]); // $result[$rs] is the array for
query resultset
$w=0;
do {
if ($q<1){
$FKMET_ID=$ETpk; // $ETpk is the first primary key comes from
recordset which is used only first time
}
$query[$w]=@mysql_query("select FKMotherEventType_ID
from $table where EventType_ID='$FKMET_ID'",$db);
$row[$w]=@mysql_fetch_array($query[$w]);
$MET_ID[$w]=$row[$w]["FKMotherEventType_ID"];
$FKMET_ID=current ($MET_ID);
}
while (++$w<$numrows);
Part2
$query=@mysql_query("select FKMotherEventType_ID
from $table where EventType_ID='$ETpk'",$db);
$row=@mysql_fetch_array($query);
$FKMET_ID=$row["FKMotherEventType_ID"];
$query1=@mysql_query("select FKMotherEventType_ID
from $table where EventType_ID='$FKMET_ID'",$db);
$row1=@mysql_fetch_array($query1);
$FKMET_ID1=$row1["FKMotherEventType_ID"];
$query2=@mysql_query("select FKMotherEventType_ID
from $table where EventType_ID='$FKMET_ID1'",$db);
$row2=@mysql_fetch_array($query2);
$FKMET_ID2=$row2["FKMotherEventType_ID"];
$query3=@mysql_query("select FKMotherEventType_ID
from $table where EventType_ID='$FKMET_ID2'",$db);
$row3=@mysql_fetch_array($query3);
$FKMET_ID3=$row3["FKMotherEventType_ID"];
$query4=@mysql_query("select FKMotherEventType_ID
from $table where EventType_ID='$FKMET_ID3'",$db);
$row4=@mysql_fetch_array($query4);
$FKMET_ID4=$row4["FKMotherEventType_ID"];
$query5=@mysql_query("select FKMotherEventType_ID
from $table where EventType_ID='$FKMET_ID4'",$db);
$row5=@mysql_fetch_array($query5);
$FKMET_ID5=$row5["FKMotherEventType_ID"];
Calvin Chua
Systems Analyst
InterClean Equipment, Inc.
734-975-2967