Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

php code generator

Posted on 2011-09-09
6
256 Views
Last Modified: 2012-05-12
Hello experts,
It is the Nth time I have to write versyy similar code to update/edit/remove records from tables using php/phpmyadmin/mysql.

My tables has some 1toMany relations and manyToMany relations
(like users, books , userbooks tables)

Is there a generator for these kind of things ? How could I speed up this "boring" and "repetitive" task ?

reagrds
0
Comment
Question by:yarekGmail
6 Comments
 
LVL 17

Expert Comment

by:nanharbison
ID: 36514651
You can do this in PHPMyAdmin, which then provides the code that you can copy and paste if you need to use it for multiple records.
0
 
LVL 9

Expert Comment

by:rinfo
ID: 36515992
Have you considered writting a databasehelper class used in say dotnet.
There helper basically are class that returns say a datatable, or datareader when parameters are set for query ,params, connection.
Something like  datatable dt = GetDatatable(qry);
Getdatatable in defined in a class which uses default connection and return a datatable.
The above example can be extended to include storeproc, params etc.
Think about this if you are a good php programmer i am sure you can write such a class in php after all this iis how config.php is prevelent in php
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 36516009
Just thought of this, find a database class where you just plug in a few things, like this one:
http://www.micahcarrick.com/php-mysql-database-class.html
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 17

Accepted Solution

by:
nanharbison earned 500 total points
ID: 36516022
Oh wait, that is a PHP4 class, here is the newer version:
http://www.micahcarrick.com/php5-mysql-database-class.html
0
 

Expert Comment

by:ctrlclick
ID: 36516117
Sounds like you should be using a framework like cakephp or yii.
Personally I use cakephp which has a very handy shell script called BAKE for baking all my CRUD functionality. The nice thing about cakephp as opposed to a code generator like phpmaker is that the code is very easy to work with after it has been generated, especially if you take the time to really learn the framework.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 36519685
Perhaps you could use some kind of "pre-canned" functions.  I usually write a "row_getter" and a "row_putter" for my tables.  These are kept in a common script and I can call the methods from any place in my programming that makes sense.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

860 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