WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wordpress and database (3 posts)

  1. cerberus478
    Member
    Posted 1 year ago #

    I would like to know if there is a way for wordpress to retrieve certain information from a database.

    In my database i have tables called flowers, address.

    For example in my flowers table I have a couple of rows that have images and descriptions of flowers and I want wordpress to retrieve all the information from that table and display it onto the site.

    I hope I made some sense.

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Try something like:

    <?php $result = $wpdb->get_results( $wpdb->prepare(
      "SELECT * FROM flowers ORDER BY name",
      $pattern) );
    ?>
  3. mr_zhang
    Member
    Posted 1 year ago #

    As long as it's in the same database, you can use the global $wpdb, just like esmi said. Here's the link from wordpress:
    http://codex.wordpress.org/Class_Reference/wpdb

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags