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 DocumentPlainview, North East Region
Select a different region: Choose Your Depot Plainview Worcrester
</select></p>
|
?>