WordPress.org

Ready to get started?Download WordPress

Forums

Extract MySQL records into sidebar... (1 post)

  1. pcoghlan65
    Member
    Posted 5 years ago #

    I have a simple MySQL database which contains three or four fields that I would like to extract and display some of these records in my sidebar.

    To give some context my blog relates to technical analysis in trading stocks and commodities. I allow users to calculate potential targets for stocks through an online calculator within the blog. The targets consist of two target prices, p and D. When the users calculate their targets I store these in a database.

    I would like to extract the last X targets and display them as follows:

    _______________
    Gold target is 836
    Apple target is 167
    RIMM target is 114
    Microsoft target is 26
    _______________________

    Where the commodity/stock name (Gold, Apple, RIMM etc) and the numbers are extracted from the database.

    I am fairly new to WP but not sure whether what I am describing is a widget or simply a code hack to the sidebar.php template?

    Any help would be much appreciated. I hope I have made the issue clear.

    Paul

    PS: In case it is useful the database table and naming is as below:

    Table - 'pivots'
    Fields
    p_stock (APPL, RIMM, Micorsoft etc)
    p_ptarget (numeric, a target)
    p_Dtarget (numeric, an alternative target)

Topic Closed

This topic has been closed to new replies.

About this Topic