Hello,
I am working on my first database and need to allow it to let users insert a record into the database. After they insert a record the page should be updated with their record added. The following is my current code. I do not know how to show an updated page after they insert their record. Also, this code worked at the beginning and the first four times I tried to enter something through my website I could but now it is not adding anymore. My website is insys.vmhost.psu.edu~vrc112/Databases.html
Firstly, you’re using mysql_query which is now deprecated and will be removed from PHP in a future upgrade. This means that one day, your entire database queries will cease to work so I advise you to get your head in a book and learn PDO or MySqli.
Secondly, the problem is, you’ve updated the database but not refreshed the page. Once you run your query (in PDO/MySQLi) use a header refresh:
[PHP]
header(“Location:yourpage.php”);
[/PHP]
This will send the user back to the page and the updated data should be now visible.