Search Posts

Author: sanjay kumar

I am trying to fetch data by selected date

I am trying to fetch data by selected date. I have callender and trying to get data on date click. In my loop I am getting data on current date.but to much confuse how I can get data, By Each date. Here is my query. $user1 = $wpdb->get_results( “select product,checked_by,submit_date from diary_user_form_storage where DATE(submit_date) = CURDATE() ; “); foreach ($user1 as $key => $value) { $product=$value->product; $product=$value->checked_by; $date=$value->submit_date; $date1 = date(‘Y-m-d’,strtotime($date)); $timing= date(‘H:i:s’,strtotime($date)); } In […]

I am trying to print value of key from json

I am fetching data from database and getting json result .Result is like this. [{“product”:”AAAAAA”},{“product”:”WWWWW”}] . I am trying to remove slace with preg_replace function.But its did not working. preg_replace(‘/[^A-Za-z0-9-]/’, $string); My sql query is. $user1 = $wpdb->get_results(“select product,checked_by,date(submit_date) from diary_user_form_storage where DATE(submit_date) = CURDATE() ;”); foreach ($user1 as $key => $value) { json_decode($value->product); echo $result=$value->product; } And output result is [{“product”:”AAAAAA”},{“product”:”WWWWW”}][{“product”:”FFFF”},{“product”:”ASSS”}] I want decode this json and try to get get key value.Any help […]