Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

datetime - PHP: report table with date gaps -


i have table in db contains summaries days. days may not have values. need display table results each column day user selected range. i've tried play timestamp (end_date - start_date / 86400 - how many days in report, use datediff(row_date, 'user_entered_start_date') , create array indexes), i've got whole bunch of workarounds summer time :( examples or ideas how make correct?

p.s. need on php side, because db highly loaded.

try datetime object:

$reportdate=date_create($user_startdate); $interval=new dateinterval('p1d');//1 day interval  $query="select s.start_date, s.end_date, s.info     summary s     s.start_date>='$user_startdate'        , s.end_date<='$user_enddate'";  $r=mysqli_query($db,$query); while($row=$r->fetch_assoc()){   $rowdate=create_date($row['start_date']);   while($reportdate < $rowdate) {//won't work if $rowdate timestamp!       //output $reportdate , blank row     $reportdate->add($interval); //increment date   }   //output $rowdate , $row[info]   $reportdate->add($interval); //increment date  } 

eta option:

based on comments, may easier dynamically generate missing dates. you'll need integer table, number of dates should appear in report output, start date , date increment.

in db create table called numbers , insert numbers 0 through 9:

create table  numbers (   num int(10) unsigned not null,   primary key (num) ); 

the numbers table can used making sequences of integers. instance, sequence 1 20:

select (   select 10*n1.num + n2.num    numbers n1 cross join numbers n2) nums between 1 , 20 order asc; 

if left join sequence query above regular query, should able generate both real , blank rows. e.g.

select alldates.d, mystuff.*     (select date_add($start_date, interval day) d          (select 10*n1.num + n2.num          numbers n1 cross join numbers n2          order asc) nums      <= datediff($end_date,$start_date)) alldates left join mystuff on alldates.d = mystuff.somedate order $whatever; 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -