MySQL Syntax Highlight - Pretty Print from phpMyAdmin

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

MySQL Syntax Highlight - Pretty Print from phpMyAdmin

Post by batfastad »

Hi everyone

I've been trawling around looking for a PHP class/function that will provide syntax highlighting for MySQL queries.

The best example I've seen of syntax highlight is in phpMyAdmin, I've not managed to find anything out there even close to that.
I had a dig through the source code of phpMyAdmin to see if it's something I could extract but it seems to be tied in with various libraries that phpMyAdmin uses, I tried extracting the function but it just failed.

I think I need to extract the whole phpMyAdmin SQL parser to use the syntax highlight functionality - which is fine, as this MySQL syntax highlight will only be used rarely by certain users as the basis of an 'advanced mysql search' script I'm creating.

It seems from the pMA source that it refers to the functions as "pretty print"

Has anyone else had any luck in extracting this library out to utilise pMA's pretty print syntax highlighting for MySQL?
Or can anyone take a brief look though the source and see which bits/libraries I need to extract? People with more PHP experience might be able to fathom the code out a bit better.

Thanks, Ben
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: MySQL Syntax Highlight - Pretty Print from phpMyAdmin

Post by onion2k »

User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Re: MySQL Syntax Highlight - Pretty Print from phpMyAdmin

Post by batfastad »

Yeah i've actually tried out GeSHi and it's very impressive,but I was looking for something a bit more advanced... like the one used in phpMyAdmin

Thanks, B
Post Reply