WordPress.org

Ready to get started?Download WordPress

Forums

Database plugin for WordPress (23 posts)

  1. sweyhrich
    Member
    Posted 5 years ago #

    I am looking for a database plugin to use within WordPress, for the purpose of display of tabular data. The ability to do links from a cell would be valuable also. It is difficult to search for such a plugin in the WordPress plugin list, since "database" matches many other things that are specific to the WordPress database.

    Does anything like this exist? Certainly MySQL is capable of handling the data I want to display; I'd like WordPress to utilize a MySQL database.

  2. Driftless
    Member
    Posted 5 years ago #

    I think I am looking for the same thing - but want to clarify (if you don't mind my hijacking this post)

    I use wordpress to display data that is pulled from a mySQL database (separate from the WP database) and am developing an admin interface for a client that will allow them do simple entry editing, deleting, updating from the admin page.

    Before I put too much time into this - does anyone know of a similar plugin -- a VERY-simple WP admin pages version of phpMyadmin that I could hack to my bidding?

    Cheers!

    @sweyhrich - after rereading your post - it looks like maybe you just want to display data... that is a simple matter of using php mysql functions like mysql_query, mysql_fetch_array and then echo the results. There are many tutorials on this. Google the above terms.

  3. Driftless
    Member
    Posted 5 years ago #

    @swyhrich -

    I wrote a plugin that I could "genericize" for your use if you are interested. It provides functions to:

    1) insert a simple DB table into your posts or pages,
    2) Update, add, delete entries in the database via the admin pages

    If anyone is interested, please let me know. Its simple - just took a few hours of hair-pulling to make it all work right.

    Off to test it with 2.7 (crossing fingers).

  4. jalbro
    Member
    Posted 5 years ago #

    Yes please!

    That sounds great!!!!

  5. kathycac
    Member
    Posted 5 years ago #

    I'm interested too - thanks so much!

  6. Driftless
    Member
    Posted 5 years ago #

    Great - hope some people find it useful.

    I am hopping internet cafes in Laos right now, so don't have a lot of time to upload it at the moment... I'll get it up by the end of the week though.

    Cheers.

  7. Driftless
    Member
    Posted 5 years ago #

    In the meantime, feel free to leave your e-mail and I can send you the ZIP file.

  8. BHopkins
    Member
    Posted 5 years ago #

    Hey Driftless, I could really use it! Email me if you have it available. brandonchopkins @ gmail

  9. Driftless
    Member
    Posted 5 years ago #

    Greetings all,

    Finally squared things away - as far as I know. There may be an odd bug or two (as is the case with these things). You can find the plugin here:

    http://www.lbell270.com/files/ext-db-manage.zip

    And please, if you do find errors, or have suggestions for improvements, please leave a note here, or send me an email.

    Cheers!

  10. sitesby
    Member
    Posted 5 years ago #

    Does anyone have a success story about the use of his plugin?

  11. Driftless
    Member
    Posted 5 years ago #

    @sitesby -- Aside from my own implementation, I haven't heard - but you can look here:

    http://www.ecologicalevolution.org/publications/

    to see an example of possible output...

    In the back-end there is a very simple admin page that allows users to Add, Edit, and Delete entries. It has been working well so far, and keeps the data in a completely separate DB than WordPress. Not just a table inside the wordpress DB -- possibly overkill depending on your needs.

    Enjoy.

  12. livetotry
    Member
    Posted 5 years ago #

    Hi Driftless,

    I've added your plugin but I'm embarassed to say that I can't figure out how to use it!

    I've followed the directions in your README and do see the External DB management link on the left hand side of WP's admin page . . . but I can't figure out how to add this great table to a blog post!

    Can you point me in the right direction?

    Best,
    Alexis

  13. Driftless
    Member
    Posted 5 years ago #

    @livetotry -- Thanks for giving it a whirl.

    It is difficult to know where you are at in the process. If you have set up the config.php file correctly to point to your DB (or a test like the example one included) and have adjusted the admin.php file to fit your needs (none needed if using the example DB) then you can use the hook <?php insert_ext_db_table() ?> to produce the table on your site.

    Note: the hook will only work if it is inserted in a template, OR if you have php enabled in your posts by using http://wordpress.org/extend/plugins/exec-php/ or similar. I have not used these, I put the hook directly in a template, so I cannot vouch for them.

    If you would like more specific help, please feel free to contact me privately via the email listed at lbell270.com or post more info here.

    Cheers!

  14. WhitePhantom
    Member
    Posted 5 years ago #

    Hi,

    I'm trying to use your external db plugin too, but I'm getting a bit lost.

    I created a MySQL db in my hosting account, and changed the db_manager_config.php to show the correct db name, user and password. I uploaded the plugin and activated it, and I've imported the db_manager_sample_db.sql file and the db is populated with the five records.

    I've put the php code "<?php insert_ext_db_table() ?>" onto one of my pages (also tried putting it in a template file) but in both cases it fails to connect to the db and I get the error message:

    Sorry, we can not connect to the database at this time. Please try to refresh.
    If the problem persists, please contact the administrator. Thank you.

    I tried uploading the exec-php plugin, but that makes no difference, and I also uploaded the php code widget (http://wordpress.org/extend/plugins/php-code-widget/) but again it fails to connect.

    Any idea what I'm doing wrong?

    Many thanks,
    J.

  15. WhitePhantom
    Member
    Posted 5 years ago #

    Aha!! I changed the first line from 'localhost' to the actual IP address and now it's working!

    Next thing now is - I have put the php code into the template, but that means that it's displaying the contents of the db on all pages. How do I get it to display on just one page? If I enter the line of php code in HTML view on the page, it doesn't work (sorry if I'm doing something really silly there, but I'm new to both WP and php).

    What to do next?

    Thanks!
    J.

  16. Driftless
    Member
    Posted 5 years ago #

    Hi WP,

    Glad its working for you -

    As for the issue of how to put it in your template, you can use several methods (working from memory here):

    1) Insert it directly into a post (using the exec-php plugin)
    2) Create a unique page template (see http://codex.wordpress.org/Stepping_Into_Templates and/or http://codex.wordpress.org/Template_Hierarchy ) and assign the page you want the DB
    3) Use conditionals in your template ( http://codex.wordpress.org/Conditional_Tags ):

    <?php if(is_page('my-database-whatever'))insert_ext_db_table() ?>

    Should work - though double check that...

    Good luck.

  17. WhitePhantom
    Member
    Posted 5 years ago #

    Thanks D, I've got it working fine now. Can you just have a quick read of what I'm doing and let me know if it all sounds kinda right?

    I'm using WP as a CMS rather than a blog, so I'm creating pages, not posts. I've gone into the Page editor for the page that I want the table to appear on, and inserted the php code to display the table: insert_ext_db_table().

    I've also edited the plugin to change the headings to what I want, and I've changed the code that displays column3 and column4 because I want them to show the text that's contained in those cols rather than the icons that were being shown (just commented out the code that was there and copied & modified the line that shows column2).

    All this is working great. But I'm wondering now what happens if/when there's an update to the plugin... what will happen to the changes I've made?

    Thanks so much for your help!

  18. Driftless
    Member
    Posted 5 years ago #

    Your welcome - you just caught me on an "online" day (I'm usually not this quick to respond.)

    Sounds like you got the hang of it.

    I guess the word "plugin" makes it sound a little tooo simple ;) -- Bear in mind that I worked this up as a "guideline" or "framework" for someone interested in doing what I struggled (at first) to do.

    Since it doesn't add any standard "plug-and-play" type functionality, and MUST be customized extensively, easy updates are fairly impossible. (Already, this is an extremely stripped down version of what I am using on my sites, each one different, that gives you some idea of what is possible.)

    Add to that the fact that the code is fairly "bullet-proof" in that it uses simple php and mySQL practices and doesn't rely on any WP specific code, it won't need updating with WP changes.

  19. johnny_sozo
    Member
    Posted 5 years ago #

    Any hints on how to get the search functionality in your example http://www.ecologicalevolution.org/publications/

  20. Driftless
    Member
    Posted 5 years ago #

    Johnny -

    The scripts came as part of package written by Mark Schenk for Jabref ( http://www.markschenk.com/tools/jabref/index.html ) and are used under the Creative Commons attribution license: http://creativecommons.org/licenses/by/3.0/ --which allows you to use, modify and share, as long as you pay attribution back to the original author (as you can see I have done at the bottom of that page.)

    I have excised the scripts and uploaded here: http://lbell270.com/files/pub-scripts.zip which you can possibly bend to your will. I was lucky in that it did exactly what I needed "out of the box."

    Good luck.

  21. johnny_sozo
    Member
    Posted 5 years ago #

    Thanks for the file driftless. I'll give it a go

  22. Jason Pelker
    Member
    Posted 4 years ago #

    Two suggestions:

    1) Why not add tables to the WordPress database to get rid of the hacking element?

    2) Then, you could upload (and update) this to the plugin repository.

  23. Driftless
    Member
    Posted 4 years ago #

    Hi jpelker - Thanks for the ideas. Thats one way to do it, and has been done I think (there are other plugins for linking a new table in the WP DB). This was a project designed specifically to link to a completely different DB hosted in a different place interacting with different people from the main WP DB.

    I am sure there are also ways that it could be more streamlined / plug-in-able to make it repository suited, but since its really just a template/skeleton for a very specific need, I don't see making that a priority.

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic