Add, Edit and Delete Record using PHP/MySQL

Language
Simple add,edit,delete record/s using PHP. From this code we learn how to connect, add, edit and delete record from the database.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

hello po!! ang galing

meg hipos hipos ka lang buh tani sugiran mu ko para kada adlaw maview q para mag most popular.... haha c ian bla naton i post ya ang gin manual ya nga jquery to ang ga flip2 nga image hahaha

this totirial is very usefull for me.. thanks......

really helpful for me as a begginer :)

hi

can you help me?

The Add Del Edit Code is cool. It is working very well except for the header("Location:index.php") which can be replaced by
print "<script>";
print " self.location='index.php';";
print "</script>";

In reply to by Anonymous (not verified)

That worked perfect after getting an error message on the page : Warning: Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line x

A very nice, simple and functioning example!

It was great but I can't seem to run view.php correctly. These messages are displayed: Notice: Undefined index: BookID in C:\xampp\htdocs\addeditdelete\view.php on line 3 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\addeditdelete\view.php on line 6 Error: Data not found..

In reply to by Anonymous (not verified)

I was getting the same error, on checking again, I had not changed the database name in the db.php file. I had earlier created a different database to which I imported the books.sql file. So try changing yours too accordingly

you are a LIFE SAVER!!!!

thanks a lot mate!!!!

Awesome script thanks!
how can i add picture upload function with this script ?

hi i have a programing and my delet funtion dose not working in delete in php how can i fexit

Hi man, This is very useful for beginners, i just searched it for my junior and found this post very useful. Keep it up. Good work

nice move"...brad

showing problem in index page loine 58
while($test = mysql_fetch_array($result))
can't load why?pls solve my problem..........

In reply to by touhid (not verified)

Maybe you forget to open brackets at the end of statement, because if i am not mistaken is a while loop that one

thank you so much...it's so helpful but i got error on the index file, on line 58.. the bracket it's opened.. please help me.. thank you so much..God bless us

In reply to by britney (not verified)

It's about your MySQL stuff .. make sure your database name, username and password is correct ! You can change it in db.php file ..

nice

Saved me!! thanx.. :)

here also simple php msql add-edit delete... http://basicwebcodes.blogspot.com/2013/12/another-more-simple-php-mysql-add-edit.html

Cannot modify header information - headers already sent by

plssssssssssssssssss send code for add,edit,delete in php

hi, its a good tutorials, but i have a problem, your original code is fine, and then i just change the variable and change the db, its keep getting me an error: undefined index in line 18-21, how should i solve this ? thx if(isset($_POST['save'])) { $title_save = $_POST['title'];//line 18 $author_save = $_POST['author'];//line19 $name_save = $_POST['name'];//line20 $copy_save = $_POST['copy'];//line21 mysql_query("UPDATE books SET Title ='$title_save', Author ='$author_save', PublisherName ='$name_save',CopyrightYear ='$copy_save' WHERE BookID = '$id'") or die(mysql_error()); echo "Saved!"; header("Location: index.php"); } mysql_close($conn); ?>

Thank a lot. you saved my time

TNX bro .. nice coding

I have tried to connect it to a user profile management system but I get the same error all the time when I try to edit informations ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource

that was amazing code for me i love that keep it up jani

thanx this is very good demo

before i was here trying

Thanks for your diligence within this Jesse. Something with regards to Yext that is certainly value mentioning: if one of typically the partner internet sites has their own own report which is considered ownership of after that this data requires priority. nike air max pas cher http://www.trackteur.fr/images/nikeairmax/

although my very own query now's... it is possible to technique so those with NO- DETECTOR will probably be nevertheless be discovered in spite of their very own counter computer software???? plsss i want to realize MessTracker can be a program provider lets you keep tabs on online/offline/invisible condition associated with just about any bing messenger accounts (max. 2accounts, 3-4 months interval history, twelve minutes diagnostic scan interval) air max pas cher http://www.lamdyne.com/cache/

Hey. Cool post. There's a dilemma together with your website in chrome, and you may want to check this The browser will be the market leader and a huge component of other people will omit your great writing because of this issue. gfdefgabadecakcb

Hello Everyone may i ask if how am i going to debug this error it appears everytime i imported the database .sql file in phpmyadmin???? please Error SQL query: -- -- Database: `books` -- -- -------------------------------------------------------- -- -- Table structure for table `books` -- CREATE TABLE IF NOT EXISTS `books` ( `BookID` INT( 11 ) NOT NULL AUTO_INCREMENT , `Title` VARCHAR( 150 ) NOT NULL , `Author` VARCHAR( 150 ) NOT NULL , `PublisherName` VARCHAR( 150 ) NOT NULL , `CopyrightYear` YEAR( 4 ) NOT NULL , PRIMARY KEY ( `BookID` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =9; MySQL said: Documentation #1046 - No database selected hello everyone may I ask if how am I going to debug this error everytime i imported the database .sql file in phpmyadmin??... please Error SQL query: -- -- Database: `books` -- -- -------------------------------------------------------- -- -- Table structure for table `books` -- CREATE TABLE IF NOT EXISTS `books` ( `BookID` INT( 11 ) NOT NULL AUTO_INCREMENT , `Title` VARCHAR( 150 ) NOT NULL , `Author` VARCHAR( 150 ) NOT NULL , `PublisherName` VARCHAR( 150 ) NOT NULL , `CopyrightYear` YEAR( 4 ) NOT NULL , PRIMARY KEY ( `BookID` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =9; MySQL said: Documentation #1046 - No database selected

Add new comment