Answer the question
In order to leave comments, you need to log in
How to filter data output for a period of time in Php mysql?
Tell me how to make data output from ... to ... time using php mysql, you need to display it on the same page, I don’t understand programming well, explain it on your fingers or with an example. Thanks a lot in advance!! Entries output like this
<?php
//Create a function to select a CERTAIN meta by ID and key name
function get_metaset_post($id, $meta_key){
//$id = Post
ID //$meta_key= Key
//Now we take it from the database data for these parameters
$query_meta = "SELECT * FROM wp_postmeta WHERE post_id = $id AND meta_key = '".$meta_key."'";
$res_meta = mysql_query($query_meta);
$return=mysql_fetch_array($res_meta);
return $return['meta_value']; // return field value
}
$query = "SELECT * FROM wp_posts WHERE post_type = 'zakaz' and post_status = 'publish'";
$res = mysql_query($query);
$togo_1=0;
while($row = mysql_fetch_array($res))
{
?>
<?php
$get_price=get_metaset_post($row['ID'], 'summa_p_1'); // use our get_metaset_post function and substitute the value
$get_price2=get_metaset_post($row['ID'], 'summa_p_2');
$prib=$get_price-$get_price2;
$itogo_1+=$prib;
$itogo_3+=$get_price;
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question