[resolved] wordpress and database (3 posts)

  1. cerberus478
    Posted 3 years 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 3 years ago #

    Try something like:

    <?php $result = $wpdb->get_results( $wpdb->prepare(
      "SELECT * FROM flowers ORDER BY name",
      $pattern) );
  3. mr_zhang
    Posted 3 years 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:

Topic Closed

This topic has been closed to new replies.

About this Topic