Evening, everyone…
Learned a lot since the last time I posted, but I recently have run into a problem.
The object of the code is to approve forms submitted by individuals.
The difficulty lies in the actual approval of the form itself. There are no syntax errors (at least none I can see) and my SQL is set up to receive updates.
When submitted it works with the appropriate output ‘echo’. However, the database is not updated.
The following is the code which pulls the infromationg information from my database where where ‘approved=0’ and lists it.
[php]<?php
$dbc = mysqli_connect(’...:’,'’,'’,'*’)
or die (‘Error connecting to MySQL server.’);
$query = “SELECT * FROM **** WHERE approved = 0 ORDER BY id ASC”;
$data = mysqli_query ($dbc, $query);
echo ‘
mysqli_close($dbc);
?>[/php]
This next set is the code in the ‘approve.php’, which is called when the individual clicks the ‘submit’ button in the ‘form’ section.
[php]<?php
if (isset($_POST[‘Approve’]))
{
$dbc = mysqli_connect(’...:’,'’,'’,'*’)
or die (‘Error connecting to MySQL server.’);
$query = "UPDATE **** SET approved=1 WHERE id='$id'";
mysqli_query($dbc, $query)
or die('Error querying database.');
mysqli_close($dbc);
echo 'Abductee approved.';
}
else
{
echo ‘Error approving abductee.’;
}
?>[/php]
The result (again) is the echo output ‘Abductee approved.’
But there is no update to the database itself.
Any help, advice, suggestions, or answer to this problem is greatly appreciated.
-ECP03