For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > May 2005 > Help!!!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help!!!
Scott V Nipp

2005-05-18, 8:55 pm

This is driving me absolutely nuts!!! I have a page that has
some checkboxes that will cause a database update for the selected
items. This page is a self referencing form page that never seems to
work. I have no idea what I am doing wrong. Here are the code portions
that I think are relevant.

This is the top of the page here:
<?php
while(isset($entry[0])) {
$redir =3D "set";
$tmp =3D $entry[0];
$update =3D "UPDATE accounts SET ctime=3DNOW() WHERE =
id_sys=3D'".$tmp."'";
$results =3D mysql_query($update, $Prod) or die(mysql_error());
array_shift($entry);
}
while(isset($all[0])) {
$redir =3D "set";
$tmp =3D $all[0];
$update =3D "UPDATE accounts SET ctime=3DNOW() WHERE =
id_sys=3D'".$tmp."'";
$results =3D mysql_query($update, $Prod) or die(mysql_error());
array_shift($entry);
}
if (isset($redir)) {
header('Location: link address');
}

$SBCUID =3D $_GET['SBCUID']; < This is the point at which some queries
build the page content
<<... Lots of stuff clipped ...>>
<Here is the guts of what builds the check
boxes. Everything displays properly>
<form method=3Dpost action=3D"user_details.php">
<?php while ($list2 =3D mysql_fetch_assoc($requests_accounts)) {
$all[] =3D $list2['id_sys']; ?>
<tr bgcolor=3D"#CCCCCC">
<td><div align=3D"center"><?php echo $list2['system']; ?> 
</div></td>
<td><div align=3D"center"><?php echo $list2['gid']; ?> 
</div></td>
<td><div align=3D"center"><?php echo $list2['shell']; ?> 
</div></td>
<td><div align=3D"center"><?php echo $list2['rtime']; ?> 
</div></td>
<td><div align=3D"center"><?php echo $list2['atime']; ?> 
</div></td>
<td><div align=3D"center"><input name=3D"entry[]" type=3Dcheckbox
value=3D<?php echo $list2['id_sys']; ?>></div></td>
</tr>
<?php } ;?>
</table>
<div align=3D"center">
<input type=3Dsubmit value=3D"Update"><input name=3D"all[]" =
type=3Dsubmit
value=3D"Update All">
</div>
</form>

The initial load of the page displays everything properly. The
problem is when I hit the "Update" or "Update All" buttons the page
reloads, but never actually makes it into the database update loops. I
cannot figure out what I am doing wrong here. I have used this kind of
code before and I am at a complete loss as to the problem. Please help
so I can actually get past this and onto some realy work. Thanks in
advance.

Scott Nipp
Phone: (214) 858-1289
E-mail: sn4265@sbc.com
Web: http:\\ldsa.sbcld.sbc.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com