updating multiple records
| From: | Cory Bantic | Date: | Wed, 02 Aug 2000 19:37:43 +0000 |
| Subject: | updating multiple records | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9799@lists.php.net to get a copy of this message | ||
Newbie alert and huge thanks to all of you who are willing to help the likes
of me:) I've been struggling with multidimensional arrays for a couple of
days now - I'm trying to provide a form that updates multiple records in 2
tables, and I think I have 3 arrays to pass, Client_ID, Event_ID, and Day.
So I have a multiple select:
echo "<input type=\"checkbox\" name='Client_ID[]'
value=\"$CID\">";
echo "<input type='hidden' name='Event_ID[]'
value='$EID'>";
echo "<input type='hidden' name='Day[]'
value='$day'>";
and I'm able to pass the arrays to the next page:
$count=count($Client_ID);
for ($i=0; $i<$count; $i++) {
echo $Client_ID[$i];
}
$count=count($Event_ID);
for ($i=0; $i<$count; $i++) {
echo $Event_ID[$i];
}
$count=count($Day);
for ($i=0; $i<$count; $i++) {
echo $Day[$i];
}
that works just as it should but then I get stuck trying to query the db for
current data to update. What I have currently is this:
$result = mysql_query( "SELECT * from Clients WHERE
Client_ID='$Client_ID[$i]' ");
$CID=array();
$Dy= array();
$last=count($CID);
for($i=0; $i<$last;$i++);
while($row = mysql_fetch_row($result)) {
$CID[] = $row[0];
$CLN = $row[1];
$CLC = $row[2];
$RC = $row[3];
$RE = $row[4];
$CLE = $row[5];
$RP = $row[6];
$CLP = $row[7];
$IN = $row[8];
$Mn = $row[9];
$Dy[]= $row[10];
$Yr = $row[11];
}
and then I have the form with text fields to echo the current data. My
query statement is not working and I'm sure it's obvious to most of you why
it isn't. Would one of you be kind enough to please enlighten me?
TIA, Cory