Friday, 15 August 2014

PHP List - Conditional Formatting -


I have a PHP date field with renewal dates "datetime".

How would I specify a style class / id in a row that was the date within 30 days of today?

For example

Mr. John Doe 31-03-2016 Mr. John Test 31-05-2016

The top row will have a class of "renewal" . There are so many distances here

  & lt ;? Php $ query = mysql_query ("Choose from * homepolicynumber with order ID") or die (mysql_error ()); Echo "& lt; Table border = '0' width = '100%' cellpadding = '10'>"; Echo "& lt; tr height = '25px' = 'center' square valign = 'head' & gt; width = '20px'> 

& lt; / th & gt; & lt; th width = '140px' & gt; & lt; p & gt; Policy number & lt; / p & gt; & lt; / th & gt; & lt; th Width = '300px' & gt; & lt; p & gt; Customer's name & lt; / p & gt; & lt; / th & gt; & lt; th width = '115px' & gt; & lt; p & Gt; Policy & lt; / p & gt; & lt; / th & gt; & lt; Thread width = '115px' & gt; & lt; p & gt; Date & lt; / p & gt; & lt ; / Th & gt; & lt; / tr & gt; "; While ($ line = mysql_fetch_array ($ query)) {resonant " & Lt; P & gt; '. $ Line ['brand'] '-' $ line ['publication'] '-r-' $ line ['id'] '& lt; / P & gt; & Lt; / TD & gt; '; Echo & lt; Td> & Lt; P & gt; '. $ Line ['title'] '& Amp; Nbsp; ' . $ Line ['first name'] '& Amp; Nbsp; ' . $ Line ['last name'] '& lt; / P & gt; & Lt; / TD & gt; '; Echo & lt; Td> & Lt; P & gt; Home & lt; / P & gt; & Lt; / Td> '; Echo & lt; Td> & Lt; P & gt; '. $ Line ['daytime'] '& lt; / P & gt; & Lt; / TD & gt; '; Echo "& lt; / tr & gt;"; } // Closed Table & gt; Echo "& lt; / table & gt;"; & Lt; b & gt; & lt; p & gt; View all & lt; / p & gt; | a class = 'link' href = '? View- All.php page = 1 '& gt; Viewed page & lt; / a & gt; & lt; / p & gt; "; ? & Gt; ($ Line = mysql_fetch_array ($ query)) {$ square}

  = (Stratetime ($ line ['daytime']); (Time () - 60 * 60 * 24 * 30))? 'Class = "the class"': 'echo' '& lt; Tr height = '25px' valign = 'center' ". $ Square" & gt; "; echo ''  

& lt;"? Delete.php id = a href = '. $ Line ['id'] '. "& Gt; & lt; img src =" .. /../images/Icons/table-delete.png"/></a></p>< ; / Td> '; echo & lt; td & gt; & lt; p & gt;' $ line ['brand'] '-' $ line ['publication'] '-r-' $ line ['id ']' & Lt; / p & gt; & lt; / td & gt; '; echo & lt; td> & lt; p & gt;'. $ Line ['title'] '& Amp; nbsp ; ' $ Line ['first name'] '' Amp; & nbsp; ' $ Line ['Last name'] '& lt; / p & gt; & lt; / td & gt;'; echo & lt; td & gt; & lt; p & gt; Home & lt; / p & Gt; & lt; / td & gt; '; echo & lt; td & gt; & lt; p & gt;' $ line ['daytime'] '& lt; / p & gt; & lt; / TD> '; echo' '& lt; / Tr & gt; ";}


No comments:

Post a Comment