Hi Friends I m not that Good or I dont know PHP So i am asking for an Help in PHP , <a rel="nofollow" class="dwnload" href="http://www.example.com/download/<?php echo get_post_meta($post->ID, "dwn_id", $single = true); ?>/"> <?php $dwn_count = $wpdb->get_var("SELECT file_hits FROM wp_downloads WHERE file_id = 2"); ?><?php echo '( ' . $dwn_count . ' Downloads )'; ?> PHP: I m using the Above code to show statistics from SQL it works fine but when i replace the Code "file_id = 2" with the Custom Field of dwn_id means ex : "file_id = dwn_id" or "file_id = $dwn_id" both didnt work which i use to define the ID of that file then it won't work please help with it. Glossary (Made So you Understand Problem More Easily and Give me Correct Solution Quickly ) : dwn_id = Custom Field used in Post to define the ID of the download dwn_count = Used to display the Statistics of the Download 2 = is used to test the code and its works when i use the number but dont work when i use dwn_id instead of number :( PHP: Hope i get a Quick reply With Correct Solution
Change: <?php echo get_post_meta($post->ID, "dwn_id", $single = true); ?> Code (markup): to: <?php echo $dwn_id = get_post_meta($post->ID, "dwn_id", $single = true); ?> Code (markup): Then: "SELECT file_hits FROM wp_downloads WHERE file_id = {$dwn_id}" Code (markup): The brackets are optional, unless you have an array, but I like to put them in
Hehehehe Thanks It really Worked thank you very much it also increased my knowledge in PHP you are great, For this Help i have Rep you