|
MyPmWikiNote: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
GoalQuery a MySQL database server and display the results in a wiki page. SolutionA module called MyPmWiki that allows you to use SQL statements in a wiki page to query a MySQL database and display the results with a table. InstallationAdd this script to your "local" directory: Include it in local.php with:
Set these variables in local.php:
The first and last variables are optional. All others must be set for MyPmWiki to work. Caution: Unless you want to allow anyone to modify your database, make sure that you set up a user for MyPmWiki that has ONLY select privileges. Also, you must include the unencrypted password for this user in your local.php file. This user should have very limited rights to your MySQL server. Usage[[$MyPmWiki SQL statement]] Working example: http://lex.tamucc.edu/wiki/MyPmWiki(approve links) DiscussionCurrently MyPmWiki uses a single database model. The administrator has control over which server and database will be used as well as table formatting. With appropriate markup, it would be possible to allow the author to select the server, user, and database as well as format the result table. Contributors
Possible improvementI have a project at http://beta.poitou-charentes.iufm.fr/~elie_fr/ai/(approve links) and file at http://adullact.net/projects/ai-ia/(approve links) to provide capabilities to either read or write (by automatic edition of data). A sql wiki... To edit data of a calendar for example, it will be useful. I also have a idea of a wiki translator : when a string have not translation, users can add language, add translation or enter a special mode to make corrections. A wiki to improve directly the wiki... François Elie I have added some ORDER BY possibilities to MyPmWiki. It supports multiple tables per page and multiple attribute order. http://www.duckstein.net/wiki/pm/PmWiki/MyPmWiki(approve links) Ralf Duckstein As I understand now, only the MySQL select statement is supported. Is it possible, as François suggests, to also support other SQL statements, preferrably insert and alike? Paul Brandt It will attempt to execute any SQL statement as it simply passes it mysql_query(). It it the permissions for the user specified in $MyPmWiki_Username that will determine what operations are allowed. --Profiles/JamesDavis Are all options of the select statement implemented, including SORT? See the answer to the previous question. --Profiles/JamesDavis pmwiki-2.2.0-beta68 -- Last modified by {{}}?
|