Solved

Sample PHP program to update/ add/delete a master record

Posted on 2010-11-14
8
907 Views
Last Modified: 2013-12-12

Is there any reference / samples to add/delete/remove and edit a master record using PHP 5.31 and MySQL ?

Many thanks.
0
Comment
Question by:AXISHK
8 Comments
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 34133711
what do u mean master record
0
 
LVL 12

Accepted Solution

by:
Avinash Zala earned 167 total points
ID: 34133713
0
 

Author Comment

by:AXISHK
ID: 34133729
for example, a customer table created in Mysql and I want to use create a PHP page to retrieve the list, add and delete it.

Tks
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 167 total points
ID: 34133755
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 34133779
even you can try with some PHP FRAMEWORKS like CAKEPHP or CI .. that comes with PHP 5.3 .. just try it
0
 

Author Comment

by:AXISHK
ID: 34134258
Thanks, any more completed examples on this as those are only part of the program.
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 34135762
I don't have an example, but I can tell you all the moving parts.

You need a script to list the rows from the data base table.  Usually you would have some kind of selectors - perhaps a drop-down select or some checkboxes to enable the client to limit the selection to the rows that are interesting.  Each of the rows would be a link to a specialized script.  The link would contain the key of the row in the URL along with an action indicator.

The specialized script would take the key from the $_GET string and look up the data base record.  If the action indicator is "List" the script will display all the information from this row.  For any other action, the POST method is required, since it represents a change to the data model.  If the action indicator is "Update" the script will pre-load the input controls of a form with the information from this row, and await the client changes and form submission.  If the action indicator is "Delete" the script will request POST method confirmation of the deletion.

In either case, when the specialized script is started via the POST method, it will perform the update or delete.

Since this kind of script can modify the data model, you might want to consider putting it behind some kind of administrative password protection.  Here is an article that shows you what you need for easy access control.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html

HTH, ~Ray
0
 

Author Closing Comment

by:AXISHK
ID: 34169644
Tks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Presenting past 6 months bug 7 30
PHP Parse error: syntax error, unexpected '[' 1 25
PHP AJAX JSON 2 61
Is there a simpler dropbox system? 10 22
This article discusses four methods for overlaying images in a container on a web page
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question