Extract MySQL records into sidebar…
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.
PS: In case it is useful the database table and naming is as below:
Table – ‘pivots’
p_stock (APPL, RIMM, Micorsoft etc)
p_ptarget (numeric, a target)
p_Dtarget (numeric, an alternative target)
- The topic ‘Extract MySQL records into sidebar…’ is closed to new replies.