Can a row ID be passed to header()? I tried putting header() inside of an if statement, but I consistently received the following message:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
Here's my code:
$result = mysqli_query($db_con,$query);
$target="Admin/upload/otherPic/".basename($_FILES['image']['name']);
if ($result){
if(move_uploaded_file($_FILES['image']['tmp_name'], $target)){
echo "<script>
alert('Record updated successfully!');
</script>";
header("Location: admin-viewacc.php?id='$result['id'];'");
}
else{
echo "Error updating record: " . mysqli_error($db_con);
}
}