Building a PHP Query editor, HELP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chuck
Forum Newbie
Posts: 2
Joined: Mon Jan 27, 2003 5:55 pm

Building a PHP Query editor, HELP

Post by chuck »

I have a PHP/MySQL database. I would like to create a query editor or (query by design page). This query editor should be accessed through the browser so the user could enter a add hoc query.

For example the user needs info from the database. He would select tables and fields to query from, then sort the results.

Some of the features would be to create joins, select fields and sort using comparison operators.

I have used this feature on the server using different interfaces such as MyAdmin etc.

Is this design feature possable using PHP?

TIA
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Sure is.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

phpMyadmin is itself written in php.

We're in an "advanced" forum so I maybe don't need to say this but, since it seems that you will have a form to POST table names, be careful which tables you allow users to query. Mysql privileges and/or a hard-coded list of allowed tables (against which the script would check POST'd vars) would be a couple of ways to stop nastiness.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

To add to that, i suggest browsing open source db managers such as phpMyAdmin to see how they did what they did and how they did it so well.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

I'm don't think that this belonged in the Advanced forum as it is a how to rather than a theory topic.

Mac
Post Reply