Add, Edit and Delete Record using PHP/MySQL
Submitted by smool on Wednesday, October 19, 2011 - 11:48.
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
Great
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..
Had Same Issue
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
php delete code
hi i have a programing and my delet funtion dose not working
in delete in php
how can i fexit
Veru Useful for Beginners
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
Maybe you forget to open
Maybe you forget to open brackets at the end of statement, because if i am not mistaken is a while loop that one
Index error
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
It's about your MySQL stuff .
It's about your MySQL stuff .. make sure your database name, username and password is correct ! You can change it in db.php file ..
Pls
how can i use dis stuff on my page, hw do i connect them together? Pls, i would b happy if u cn mail me at [email protected]
undefined index
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);
?>
Add username information
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
Edit data in database using form in php
I want to know what are the PHP codings for editing data in database using php tages
nike air max pas cher
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/
air max pas cher
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/
importing the .sql file in phpmyadmin
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
- Add new comment
- 3545 views