hi
I'm looking for very basic code that will allow me to add, edit, view all and delete database records.
I already have a set number of fields in a single database table, so don't need any dynamic thing to add rows or whatever.
Here's pretty much what I'm after, but it's doing like an inventory thing.
Know of some simple code that just adds a new entry (name, email etc), allows me to edit, delete and view all (preferably in a single php file)?
thanks
After simple code to add, edit, view, delete records
Moderator: General Moderators
- andym01480
- Forum Contributor
- Posts: 390
- Joined: Wed Apr 19, 2006 5:01 pm
- andym01480
- Forum Contributor
- Posts: 390
- Joined: Wed Apr 19, 2006 5:01 pm
You are confusing your terms somewhat.I already have a set number of fields in a single database table, so don't need any dynamic thing to add rows or whatever.
Here's pretty much what I'm after, but it's doing like an inventory thing.
Know of some simple code that just adds a new entry (name, email etc), allows me to edit, delete and view all (preferably in a single php file)?
If you want to add a new entry - you are adding a new row!
What you want to do is create a index.php file that has a link to add a new row - with a form and ability to add
Structure of add.php
Code: Select all
if (isset($_POST['submitted']{// add the entry
exit();
}
//form with hidden field called submittedHave two icons - for each row - one to edit and one to delete and make them a link to edit.php or delete.php that passes a variable with the id of that row. Look at phpmyadmin at the browse page of a table. View the source and it will show you what you want to generate.
Come back when you have had a go!