WordPress.org

Ready to get started?Download WordPress

Forums

Retrieving conditional SQL data from wpdb (1 post)

  1. tabletskopen
    Member
    Posted 1 year ago #

    Hello everyone,

    Thank you for reading this topic. I'm having difficulties retrieving information from the WordPress db. I know what information I want from my database but I don't exactly know how to code it. I hope you guys can help me started.

    Here is what I want to achieve.

    I want to add a couple of tables to the WPdb which contains information about product prices and links to images. Each table represents a supplier. This part I can do using a tool to import a CSV file.

    The next part is to create a function in the function.php to extract the information from the tables. Each post gets a specific productnumber in a Custom Field. When the post is created the function should be called and looks at the productnumber and checks if the productnumber matches a field in de productnumber column in each table. When a field matches, the other fields in the row should be remembered. When all tables are checked then the result should be a list of prices sorted on the lowest price first together with the corresponding images

    I know that I should call the global $wpdb to connect to the database. It's especially the conditional SQL queries I'm having difficulties with.

    Does this make any sence? I hope you guys could help me started with the coding on this. Many thanks in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic