Link to home
Start Free TrialLog in
Avatar of Rcollins207
Rcollins207Flag for Australia

asked on

PHP SQL in wordpress

Thanks for any help in advance
i have a site that im trying to add features in but im not that good with php yet... my normal coding language is coldfusion.

what im trying to do is get my image slider on my front page to look like the posted image which i have but the only thing i cannot get is the price from the database to display as well... mainly because i dont understand the relationship between the post and postdata tables....

so what i need is some help to write the code that with get the price and display it on top of the images that rotate every 5 secs on my front page....

also, wordpress makes the php code very confusing for me.... am i just really crap at php or is wordpress really advance php??? or just confusing to everyone lol..

please any help would be wonderful...

 mul23072-wrdp2--1-.xls  template-front.php User generated image
Avatar of jrm213jrm213
jrm213jrm213
Flag of United States of America image

Hi,

If the price is in a custom field as part of each post, you get it using the function get_post_custom http://codex.wordpress.org/Function_Reference/get_post_custom

It looks like the excel that you attached is the posts table, the price data should not be in there. The only other thing I could think is that the price data is in a separate table. How does it get entered?

Avatar of Rcollins207

ASKER

a custom field... but the price data is in the other tab in excel called postdata which is the other table..... and i kinda need help with the code as i suck at php sorry
I think you could replace:

<?php echo "<h1>testing</h1>"; ?>

with

<?php
$key = "name_of_your_custom_field";
$custom_values = get_post_custom_values($key, get_the_ID());
//I am going to guess you only have one value for the key, but just in case...
 foreach ( $custom_values as $key => $value ) {
    $myvalue = $value;
  }
//maybe do a check to make sure value is what you expect, then if it is echo it out...
echo($myvalue);
?>
ASKER CERTIFIED SOLUTION
Avatar of jrm213jrm213
jrm213jrm213
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ty