PHP DB does not update, help!

Hi everyone, I need some major help. I’m putting together a inventory database and the redirect works fine but the data in the DB is not updated. I am fairly new to PHP so any help you could offer would go along way!

thanks!

Here is the code

// Connect to server and select databse.
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect”);
mysql_select_db("$db_name")or die(“cannot select DB”);

$sql=“SELECT * FROM $tbl_name WHERE depot = ‘plainview’”;
$result=mysql_query($sql);

// Count table rows
$count=mysql_num_rows($result);

//update
if(isset($_POST[‘Submit’])){
for($i=0;$i<$count;$i++){

$sql1 = "UPDATE $tbl_name SET

available='{$_POST['available'][$i]}', 
rent='{$_POST['rent'][$i]}', 
corp_ready='{$_POST['corp_ready'][$i]}', 
down='{$_POST['down'][$i]}', 
gfs='{$_POST['gfs'][$i]}',
dateTime = NOW()  

WHERE id=’$id[$i]’";

$result1 = mysql_query($sql1) or die(mysql_error());
}
}

//redirect
if($result1){
header(“location: plainview.php”);
}

mysql_close();

?>

Untitled Document

Plainview, North East Region

Select a different region: Choose Your Depot Plainview Worcrester

            </select></p>

<?php while($rows=mysql_fetch_array($result)){ ?> <?php } ?>
ID Product Name Available Rent Corp Ready Down GFS
<?php $id[]=$rows['id']; ?><?php echo $rows['id']; ?> <?php echo $rows['product']; ?>
<?php

?>

Sponsor our Newsletter | Privacy Policy | Terms of Service