473,327 Members | 2,012 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,327 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
reasons)
- 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 1789
SOR
<comp.lang.php , windandwaves , wi*********@coldmail.com>
<Vr*****************@news.xtra.co.nz>
<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>
<Vr*****************@news.xtra.co.nz>
<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

Nicolaas
Jul 17 '05 #3

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

Similar topics

2
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...
1
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...
1
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...
6
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...
2
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...
1
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? ...
11
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: -...
2
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...
3
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...
4
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",...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.