Articles |
[next] |
The Iraq issue, part 2
|
Information presentation: Systasis comments, part 1
|
The Iraq issue, part 1
|
Our first PHP project: MySQL Interface
|
[previous] |
Your comments appear at once, but will be censored if they don't follow the usual etiquette guidelines. We do not require registration in order to encourage dialogue, so please don't abuse this courtesy. HTML tags allowed (in the message body only) are B, I and A, hence you should use < instead of <, unless opening the specific tags. |
|
|
|
|
Our first PHP project: MySQL Interface |
---|
Friday, 3 January 2003 |
Symeon Charalabides (symeon@systasis.com) |
Soon after our web-development company, webmate.gr, entered the world of PHP and MySQL, it became apparent that a good graphical interface to MySQL would save us a lot of console commands and time. My first project was to create such a web interface, learning the basics of PHP on the way.
MySQL Interface was created withing a week or two in great enthusiasm, and helped us through most of the learning curve of designing database-backed websites. We eventually abandoned it in favour of phpMyAdmin, as we didn't have the time to make our own script so complete and there was no point spending our time on a commodity that was readily available.
A couple of years later, however, I believe I may as well include it in this website. It may be useful to somebody who's overwhelmed by the plethora of information that phpMyAdmin offers, but still doesn't want to use a command prompt, but it's mostly for sentimental and historical reasons. You can download MySQL Interface together with the GPL license (under which it is available) and the FAQ, which I copy below for amusement:
Q: What exactly does MySQL interface do?
A: It allows you to interface to your MySQL database via a series of HTML forms. Simply place the script anywhere where it is viewable with your browser, open it on your browser and work away. Do not alter the file name.
Q: Why would I need something like that?
A: We're not saying that you do. If, however, you do not want to interface with your MySQL via a terminal, or your provider doesn't allow you direct access to it, you will probably find that this is the best way to go about it.
Q: What are the system requirements?
A: The script was developed on PHP 4.0.5, though there should be no problem with older versions. If you find any, please make sure it is not the |SEPARATE_MySQL_FIELDS| problem, then let us know. All versions of MySQL should be supported. Again, let us know if the last statement is wrong.
Q: Which languages does MySQL interface support?
A: Change the ISO setting on line 3 to what suits you best. We wish that you do no less.
Q: Have you noticed that the interface is somewhat minimal and a person of less discretion might even say empty?
A: Yes. We made it.
Q: Well, why?
A: MySQL interface is used by people of various cultural backgrounds. Semantics is too wide an issue to raise here but, being reductive, fewer messages means fewer misinterpretable messages. We'd rather you spent a bit more time with it, than curse us over your accidentally deleted tables.
Q: Why is the interface in English only? Are you not proud to be Greek?
A: Because we wish to keep MySQL interface as short as possible and in a single file. We created it on the assumption that the people who will find it useful, i.e. people who want to interact with MySQL via PHP, both of which are used, in the devastating majority of cases, in English, will de facto have a command of English adequate to interact with it succesfully.
As regards the second question:
We go Doot. Doot Doot.
Q: The |SEPARATE_MySQL_FIELDS| problem, or
"How did you pass a variable length array of variable length arrays to a PHP function via a HTML form?
A: We didn't. We turned it into a string and separated the fields using the expression |SEPARATE_MySQL_FIELDS|. Consequently, you can't delete a row with this expression anywhere in it. We felt that if you do manage to find a table with exactly this expression inside it, maybe you should be out buying lottery tickets instead.
Q: But I really, really have to delete a line that includes |SEPARATE_MySQL_FIELDS| ...
A: Thought about dropping the whole table yet?
OK, seriously now, since you must, change |SEPARATE_MySQL_FIELDS| on line 4 to a symbol, word or expression that doesn't exist anywhere on the line. Avoid using the following: " \ ' & > <
Q: Hey! I can't create a table whose fields or title contain those special characters either!
A: We're sorry, MySQL won't allow it. Nothing to do with us, except, of course, you're better off this way.
For the record, it is your responsibility to conform to MySQL standards when creating tables, lines or columns. For instance, defining a primary key is not necessary (although strongly encouraged), as long as the table follows a certain structure, which we won't go into here. You should be somewhat familiar with the documentation, anyway.
Q: Why don't I have the option to create a table with more than 40 fields?
A: Because you shouldn't need so many. In fact, 10 should be enough for 99% of cases. However, patronising is not our cup of coffee and if you feel that you're not better off splitting your table into more, change the number 40 on line 5 to the number you require.
We still advise against it, though...
Q: Why don't you just use a persistent MySQL connection?
A: Most providers close even those automatically every time a script is (re)called for security reasons. MySQL doesn't fork out a new process every time an open connection is requested, anyway, it uses the old one.
Q: Why do I get warnings instead of a database list when I use it on my provider?
A: Because your provider only allows you one database and is reluctant to show you other peoples'. They've disallowed database listing as a security feature. Simply enter your database name on the first form and you'll jump straight to your table list.
Q: I love MySQL interface! I use it every morning before breakfast, and I can now clearly see how empty and meaningless my life was without it. How can I best express my adoring feelings and eternal gratitude towards you?
A: Pass it on. Send us feedback on what changes or new features you'd like to see, and tell your friends to do the same. Become a better citizen. Show the cats of the world more respect. If you happen to be a prodigious, well-mannered, gorgeous, rich single woman, drop by the office.
|
I should mention that some of the issues in this FAQ have changed now: it's easier and sometimes faster to use persistent connections and you don't have to close them. There are better ways to deal with the |SEPARATE_MySQL_FIELDS| problem. Our coding style has changed significantly. Above all, don't e-mail us asking for new features/changes because we do not support this script anymore. It's just hard to forget our years of innocense. |
|
|
|