Hi ya - I'm having a big problem with this little time sheet thing. I've created a script where you can add, edit, and tally up your time your job via mysql. I can add the info to the db with no problems, my big problem is updating the info. See I'm trying to loop through the db, and display the info, with a update button for each entry. I put it in a while loop which increments the "submit" button 1 one.
The code looks like this
<?php
$connect = mysql_connect("localhost", "root");
$select = mysql_select_db("main", $connect);
if ($update) {
$find = "update loop set name='$name' where name='$name'";
$findmore = mysql_query($find);
echo ($name);
}
else {
$find = "select * from loop;" ;
$stuff2 = mysql_query($find);
$stuff3 = mysql_fetch_row($stuff2);
$num = mysql_num_rows($stuff2);
do {
++$i
?>
<?php echo ($HTTP_POST_VARS); ?>
<form method="get" action="<?php echo ($php_self); ?>">
<input type="hidden" name="update" value="update">
<input type="hidden" name="id" value="<?php echo ("$stuff3[0]"); ?>">
<input type="hidden" name="name" value="<?php echo ("$stuff3[1]"); ?>">
<input type="text" name="name" value="<?php echo ("$stuff3[1]"); ?>">
<input type="submit" name="duh<?php echo ($i); ?>">
<br>
<?php
}
while ($stuff3 = mysql_fetch_row($stuff2));
}
?>
Everytime I run this script only the last entry gets changed - what is the easiest way for me to do this? I've looked at the source code before I submit the info and everything is there, the value is what it's supposed to be, and the names are ok. For some reason the variables just aren't coming across
thanks in advance