473,372 Members | 950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

php my admin - reinventing the wheel - mysql front-end

Hi Folk

I am an PHP novice.

Right now, I am redeveloping the wheel by creating my own type of PHP
MyAdmin tool for my clients so that they can manage some data. A good
exercise, but probably done before!

My question: is there something out there similar to what I describe below
or how do you go about it (I am sure that all of you have faced this problem
before)? How do you recommend I proceed?

PHP MyAdmin would not be suitable for my clients, because it contains too
much and it is too technical (e.g. i dont want them to change the structure
of the database).

So far, I have created a simple structure that allows the user to edit any
table in my database. Here is an overview of how I do it. If anyone wants
a copy of the files, please email me php at ngaru dot com.

[1] list.php - shows the data from a table in a list - allowing users to
a. delete a row
b. click on a field for a related id items (they are shown as meaningful
data from the look-up table rather than the id). For example in the list of
customers, the city is shown as the name of the city rather than the city id
(linked table)
c. click on the edit button for any row

[2] edit.php (shows a form where you can either add or update a row)
a. provides the ability to "go-through" to child data (e.g. if you are in
the customer table then you can click through to the customer order table
for that customer).

[3] to make it all work, I have created a table DEF that defines the data
structure. While I have not formally created relationships in the MySql
database (I do not know how to), this table shows them, because a field like
LIS_ID relates back tot the LIS table and a field CAM_ID relates back to the
CAM table. The DEF table describes each field with:
- name of the table it belongs to (e.g. CAM)
- field name (e.g NAM)
- field name to be used as ID in a form (e.g. campaignname) - to avoid
people knowing the exact names of the fields in the database (for security
- field name to be used for users (e.g. Campaign Name)
- function used to validate an entry in the edit form for this field

The beauty is that, using this DEF table, the list.php and the edit.php
pages can be created for any table in the database. Those fields and tables
that are admin only I simply leave out of the DEF table.

I have also written the little function below to create a dropdown list for
look-up fields.

//creates a dropdown for a table
function dd($table, $name, $class, $select){
$sqlw = dd_where($table, dd_restricter() );
$sql = 'SELECT `ID`, `'.dd_descriptor().'` FROM `'.$table.'` '.$sqlw.'
ORDER BY `'.dd_descriptor().'`;';
$query = mysql_query($sql);
$v = '<SELECT Name="'.$name.'" ID="'.$name.'" CLASS="'.$class.'">';
while ( $row = mysql_fetch_row($query) ) {
$v .= '<OPTION ';
if ( $select && $row[0] == $select ) {
$v .= ' SELECTED ';
$v .= ' VALUE="'.$row[0].'">'.$row[1].'</OPTION>';
$v .= "</SELECT>";
return $v;

function dd_restricter () {
//returns the name of the field that contains the most meaningful
description for a record
function dd_where($t, $restrictt) {
$id = sgd($restrictt.'_ID');
$v = ' WHERE ';
if($t == $restrictt ) {
$v .= ' `ID` = "'.$id.'" ';
else {
if( is_parent($t, $restrictt) ) {
$v .= ' `'.$restrictt.'` = "'.$id.'" ';
else {
$v = ' WHERE `ID` > -1 ';
return $v;
function sgd ($fieldname) {
//returns a user-specific value from the session table
Jul 17 '05 #1
2 1803
<comp.lang.php , windandwaves , wi*********@coldmail.com>
<Wed, 13 Jul 2005 11:33:59 +1200>
My question: is there something out there similar to what I describe below
or how do you go about it (I am sure that all of you have faced this problem
before)? How do you recommend I proceed?

MySQL Administrator is a windows app and probably well worth a look as
it will no doubt give you a few ideas on your custom layout and editing
options .

Be sure and post a url if you get your custom editor working .

Jul 17 '05 #2
SOR wrote:
<comp.lang.php , windandwaves , wi*********@coldmail.com>
<Wed, 13 Jul 2005 11:33:59 +1200>
My question: is there something out there similar to what I describe
below or how do you go about it (I am sure that all of you have
faced this problem before)? How do you recommend I proceed?

MySQL Administrator is a windows app

I was actually more interested in PHP... but I will have a look. I have not
loaded MySql on my pc so it may be hard for me.

Thank you

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Asher Golan | last post by:
Which '.exe' file should I run in order to start the MySql Server ? How do I creat a new data base ? I learnt how to access MySql using php commands, but dont know how to create the database. Is...
by: JStrummer | last post by:
I'm converting some static HTML pages to use PHP-mySQL. I will be able to add/modify/delete records via the web using phpmyadmin, but I will need to develop more user-friendly admin pages for...
by: CAS | last post by:
Hi, New on the group so forgive me if this is a FAQ... I've been looking for a tool to handle user admin (for a website I'm knocking together for a club), after all there is no point...
by: Dmitri | last post by:
Hi there, Does anybody know what is DB2 UDB admin API equivalent to "db2 terminate" command? Some background: I'm developing monitoring application(http://chuzhoi_files.tripod.com). I want...
by: Doug | last post by:
Not that I'd actually do this... but knowing the answer would give me a bit more understanding of the .NET Framework and the base class libraries - specifically how things work in relation to my...
by: Graham Smith | last post by:
Hi, I'd like to write a little bidirectional connector, which should sync data between two systems. Are there any components which I can use for this purpose, without reinvening the wheel? ...
by: AnhTai | last post by:
Hi all, I've just installed MySQL 5.0 on my sun box (runing Solaris 10, install from blastwave). This is my first time with MySQL so I don't have any exp with it. I have some troubles as: -...
by: xkp | last post by:
Hi all, i used to use mysql front with my old mysql 3.x version. now i have upgraded to mysql 5.0 and i have just discovered mysql front is not available anymore. I really liked it cause it...
by: rollo gerfollo | last post by:
Hi, I have been using MySql-Front Gmbh right up until Monday 7-14-2007, when after downloading a bunch of stuff and keeping dozens of files and windows open for a couple of days, I try to start...
by: karthikeyanck | last post by:
I'm a newbie, I've installed PHP, Apache and MySQL on my Ubuntu system I've trouble in quering the data from MySQL when using the query function within PHP. I 've created a Database "test",...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.