WordPress.org

Ready to get started?Download WordPress

Forums

Using Existing PHP/MySQL Table (8 posts)

  1. DavePorter
    Member
    Posted 5 years ago #

    Hi Everyone,

    I'm considering using WordPress to convert a couple of existing web site's.

    They have existing pages that access data from a MySQL database, such as categorized products, links & various other types.

    Can I simply add the custom tables to the WordPress Database and use my existing PHP code to re-create these pages or am I forced to use the WordPress Database API (wpdb) ( ezSQL ) ?

    TIA, Dave Porter

  2. Konstantin Kovshenin
    Member
    Posted 5 years ago #

    I think it'd be wiser to write a little export script. It shouldnt take much time if the old db structure is not too complicated.

  3. DavePorter
    Member
    Posted 5 years ago #

    Thanks Kovshenin,

    Perhaps I was not clear - I can easily export the data from the old database to a new table in the WordPress database...
    ( using phpMyAdmin or similar )

    I would start from scratch with the new site, pick a suitable template, copy over the static content etc...

    But I was wondering about using the existing pages code ( PHP ) to recreate the pages that have mySQL content in a wordpress page.

    It would just be a time saver. I will learn the $wpdb class given time !

    regards, Dave

  4. Konstantin Kovshenin
    Member
    Posted 5 years ago #

    DavePorter, oh I see. Well, you might just use your php files and access them directly on domain.com/file.php. The wordpress permalink feature omits rewriting if file or directory exists.

  5. DavePorter
    Member
    Posted 5 years ago #

    OK, Thanks

    If I create a new Plugin and just have a function that has the existing PHP code in it will that work ?

    cheers Dave

  6. Konstantin Kovshenin
    Member
    Posted 5 years ago #

    It will, although you might just write the code in functions.php. Or perhaps have ready-to-include php files, then use the PHP-Exec plugin to include() certain files in the right places. Not sure it makes sense though...

  7. DavePorter
    Member
    Posted 5 years ago #

    Yes that makes sense...
    Thank you I will experiment and see how I go.

    regards, Dave

  8. Konstantin Kovshenin
    Member
    Posted 5 years ago #

    You're welcome.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.