Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 918
  • Last Modified:

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


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

Many thanks.
0
AXISHK
Asked:
AXISHK
3 Solutions
 
Loganathan NatarajanLAMP DeveloperCommented:
what do u mean master record
0
 
Avinash ZalaWeb ExpertCommented:
0
 
AXISHKAuthor Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Loganathan NatarajanLAMP DeveloperCommented:
0
 
Loganathan NatarajanLAMP DeveloperCommented:
even you can try with some PHP FRAMEWORKS like CAKEPHP or CI .. that comes with PHP 5.3 .. just try it
0
 
AXISHKAuthor Commented:
Thanks, any more completed examples on this as those are only part of the program.
0
 
Ray PaseurCommented:
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
 
AXISHKAuthor Commented:
Tks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now