<?php
$conn = mysqli_connect ("localhost", "B00657633", "Jpr3EjPw")
or die ("could not connect: " . mysqli_error($conn));
print "successful connection<br>";
mysqli_select_db($conn, 'B00657633') or die ('db will not open');
header('Location: sql5_2.php');
$query = "UPDATE patient3 SET AGE=68 WHERE POST_CODE='bt667ed'";
$result = mysqli_query($conn, $query) or die ("Query is invalid");
$rownum = mysqli_num_rows($conn)
$col = mysqli_num_fields($conn);
echo "<table border='2'><tr><th>POST_CODE</th>";
for($i=0; $i<$rownum; $i++){
$rows = mysqli_fetch_row($result);
echo "<tr>";
for($j=0; $j<$col; $j++){
echo "<td>" . $rows[$j] . "</td>";
}
echo "</tr>";
}
echo "</table>";
$rownum = mysqli_affected_rows($conn);
echo $rownum . " Records have been updated.";
mysqli_close($conn);
?>
That is the first part of my web page, the second part is below:
<?php
$conn = mysqli_connect ("localhost", "B00657633", "Jpr3EjPw")
or die ("could not connect: " . mysqli_error($conn));
print "successful connection<br>";
mysqli_select_db($conn, 'B00657633') or die ('db will not open');
$query="SELECT * FROM patient3";
$result = mysqli_query($conn, $query) or die ("Query is invalid");
$num = mysqli_num_rows ($result);
$col = mysqli_num_fields ($result);
echo "<table border='2'><tr><th>PATNUM</th><th>PAT_FORENAME</th><th>PAT_SURNAME</th><th>STREET_ADDRESS</th><th>TOWN</th><th>POST_CODE</th><th>AGE</th>";
for($j=0; $j<$num; $j++){
$rows = mysqli_fetch_row($result);
echo "<tr>";
for($i=0; $i<$col; $i++){
echo "<td>" . $rows[$i] . "</td>";
}
echo "</tr>";
}
echo "</table>";
echo " Records have been updated.";
mysqli_close($conn);
?>
No matter what I try it doesnt let me update any information in my sql. Really not sure where i have went wrong, please help me. The second part is displaying my table. Connection to the server is fine, however nothing changes in the table once i click refresh