Activity Stream
48,167 MEMBERS
63441 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 10 of 13

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    You can call me G
    just assign a class to the table row in case $today >= $date and style it the way you want in the stylesheet.

    PHP Code: 
                                            echo "<thead><tr><th>Date</th><th>Service Report No</th><th>Hospital Name</th><th>Description</th><th>Model No</th><th>Serial No</th><th>Date of Installation</th><th>PPM Due date</th><th>Warranty</th></tr></thead>";  
                                           
    $today            =  new DateTime("now");  
                                              
                                            while (
    $row $result->fetch_object())  
                                            {  
                                                    
    $bgclass "gradeX ";
                                                    
    $date = new DateTime($row->ppmduedate);  
                                                    if (
    $today >= $date) {$bgclass "expireWarn"}  
                                                    
    $due $date->format("m-d-Y");  
                                                    
    // set up a row for each record  
                                                    
    echo "<tr class=$bgclass>";  
                                                      
                                                    echo 
    "<td>" $row->dateinsrep "</td>";  
                                                    echo 
    "<td>" $row->servicereport "</td>";  
                                                    echo 
    "<td>" $row->hospitalname "</td>";  
                                                    echo 
    "<td>" $row->description "</td>";  
                                                    echo 
    "<td>" $row->model "</td>";  
                                                    echo 
    "<td>" $row->serial "</td>";  
                                                    echo 
    "<td>" $row->dinstall "</td>";  
                                                    echo 
    "<td>" $date ."</td>";  
                                                    echo 
    "<td>" $row->warranty "</td>";  
                                                    echo 
    "</tr>";  
                                            } 
    in your CSS, for instance to change the background of the row to red, something along the lines of:

    PHP Code: 
    .expireWarn {
        
    background-colorred;
        
    color#fff;

    Feel free to play around with the font/background colors

    Regards,
    Gaurav
    Gaurav Reviewed by Gaurav on . i need help php and sql script I am making in this database should help me see my database images http://vvcap.net/db/KWBZVLTBV8XJYL-0YKBb.png PPM Due Date in the day, as it becomes red in the table. like: today date is: 28-02-2012, today agha khan product is expire to auto change color this table and i want to change date format like: D-M-Y please help me Rating: 5



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    heroturko.biz softpk.com gfxtra.biz hotfilegfx.com
    sir no this code is not work show this error

    Catchable fatal error: Object of class DateTime could not be converted to string in G:\WampDeveloper\Websites\DefaultWebsite\webroot\d atabase\ins-view.php on line 455

    455 Line is:

    // set up a row for each record
    echo "<tr class=$bgclass>";


    and i am using code

    PHP Code: 
     $today  =  new DateTime("now");  
                                    
                                    
    // display records in a table
                                            
    echo "<div class='mws-panel grid_8'>";
                                            echo 
    "<div class='mws-panel-header'><span class='mws-i-24 i-table-1'>Installation Report</span></div>";
                                            echo 
    "<div class='mws-panel-body'>";
                                            echo 
    "<table class='mws-datatable mws-table' id='example'>";
                                            
                                            
    // set table headers
                                                       
                                            
    echo "<thead><tr><th>Date</th><th>Service Report No</th><th>Hospital Name</th><th>Description</th><th>Model No</th><th>Serial No</th><th>Date of Installation</th><th>PPM Due date</th><th>Warranty</th></tr></thead>";
                                            
                                            
                                             while (
    $row $result->fetch_object()) 
                                            { 
                                                    
    $bgclass "gradeX";
                                                    
    $colorPrefix ''
                                                    
    $colorSuffix ''
                                                    
    $dateinsrep = new DateTime($row->dateinsrep);
                                                    
    $dinstall = new DateTime($row->dinstall);
                                                    
    $date = new DateTime($row->ppmduedate); 
                                                    if (
    $today >= $date) {$bgclass "expireWarn";}
                                                    
    $due $date->format("d-m-Y");  
                                                    
    $due $dateinsrep->format("d-m-Y");
                                                    
    $due $dinstall->format("d-m-Y");
                                             
                                            
                                                    
    // set up a row for each record
                                                    
    echo "<tr class=$bgclass>";
                                                    
                                                    echo 
    "<td>" $dateinsrep->format("d-m-Y") . "</td>";
                                                    echo 
    "<td>" $row->servicereport "</td>";
                                                    echo 
    "<td>" $row->hospitalname "</td>";
                                                    echo 
    "<td>" $row->description "</td>";
                                                    echo 
    "<td>" $row->model "</td>";
                                                    echo 
    "<td>" $row->serial "</td>";
                                                    echo 
    "<td>" $dinstall->format("d-m-Y") . "</td>";
                                                    echo 
    "<td>" $date "</td>";
                                                    echo 
    "<td>" $row->warranty "</td>";
                                                    echo 
    "</tr>";
                                            } 


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Selling] Excellent Matrimonial Script| Complete readymade Matrimony Script Available
    By matriscript4u in forum Marketplace (Buy, Sell and Trade)
    Replies: 0
    Last Post: 23rd Oct 2012, 02:54 PM
  2. Replies: 12
    Last Post: 13th Mar 2012, 02:23 PM
  3. Greasemonkey script: Megaupload Premium Multifetch Script
    By Dman in forum Webmaster Resources
    Replies: 46
    Last Post: 15th Dec 2011, 01:07 AM
  4. [Selling] Rslinkgens Premium link generator script V1 -Most advanced and viral script
    By vccshopper in forum Completed Transactions
    Replies: 0
    Last Post: 24th Jun 2011, 08:10 PM
  5. [Selling] A.A.S. (Adult Automated Script For ClipBucket Video Script)
    By tangi in forum Completed Transactions
    Replies: 0
    Last Post: 25th Mar 2011, 12:45 PM

Tags for this Thread

BE SOCIAL