Closed Thread
Results 1 to 1 of 1

Thread: Load updated data to exisiting table

  1. #1
    yonghan is offline Learning Programmer
    Join Date
    May 2008
    Posts
    99
    Rep Power
    0

    Load updated data to exisiting table

    Hi all, i got codes like this

    views/admin/order_home
    Code:
    <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.js"></script>
    <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.form.js"></script>

        <script type="text/javascript"> 
            // wait for the DOM to be loaded 
            $(document).ready(function() { 
            $("#msg").hide();
                // bind 'myForm' and provide a simple callback function 
                $('#myform').ajaxForm(function() { 
                    //nampilin di div message string yg ada di dalam html()
                    $("#msg").html("Berhasil update order").fadeIn(1500);
                    $("#msg").fadeOut(1500);
                  
                });
                
                
            }); 
        </script> <h1><?php echo $title;?></h1>
    <?php
    if ($this->session->flashdata('message')){
        echo 
    "<div class='message' name='msg' id='msg'>".$this->session->flashdata('message')."</div>";
    }
    echo 
    "<div name='msg' class ='msg' id='msg'></div>";
    //echo "<div class='message' name='msg' id='msg'></div>";
    echo "<table border='1' cellspacing='0' cellpadding='3' width='600' id='order_home' name='order_home'>\n";
        echo 
    "<tr valign='top'>\n";
        echo 
    "<th>No Order</th>\n<th>No Cust</th><th>Tgl Pesan</th><th>Modified</th><th>Status</th><th>Update</th><th>Actions</th>\n";
        echo 
    "</tr>\n";
        
    if (
    count($order)){
        foreach (
    $order as $key => $list){
            echo 
    "<tr valign='top'>\n";
            echo 
    "<td>".anchor("admin/order/detail/".$list['no_order'],$list['no_order'])."</td>\n";
            echo 
    "<td>".$list['custid']."</td>\n";
            
    $datetime strtotime($list['tgl_pesan']);
            
    $orderdate date("d-m-y H:i "$datetime);
            echo 
    "<td>".$orderdate."</td>\n";
            
    $modifieddate strtotime($list['modified']);
            
    $modified date("d-m-y H:i "$modifieddate);
            echo 
    "<td id='modif' name='modif'>".$modified."</td>\n";
            
    //echo "<td>".$list['modified']."</td>\n";
            //echo "<td align='center'>".$list['status']."</td>\n";
            
    $attributes = array('id' => 'myform');
            echo 
    form_open('admin/order/edit',$attributes);
            echo 
    "<td align='center'>".form_dropdown('status',$status,$list['status'])."</td>\n";
            echo 
    form_hidden('id',$list['id']);
            echo 
    form_hidden('status_order',$list['status']);
            
    $data = array('name'=>'notif','id'=>'notif');
            echo 
    "<td align='center'>".form_checkbox($data)."<label for='update'>Notifikasi cust</label>".form_submit('submit','update')."</td>\n";
            echo 
    "<td align='center'>";
            
    //echo anchor('admin/kategori/edit/'.$list['id'],'edit');
            
    echo anchor("admin/order/edit/".$list['no_order'],img(base_url().'/images/edit.jpg'));
               echo 
    " | ";
            
    //echo anchor('admin/kategori/delete/'.$list['id'],'delete');
            
    echo anchor("admin/order/delete/".$list['no_order'],img(base_url().'/images/delete.jpg'));
               echo 
    "</td>\n";
            echo 
    "</tr>\n";
            echo 
    form_close();
        }
        
    }
    echo 
    "</table>";
    ?>
    controller/order
    Code:
    function edit($no=0)
        {
            if (
    $this->input->post('id'))
            {
                if (isset(
    $_REQUEST['notif']))
                {
                
    $this->input->post('status_order');
                
    $result=$this->MOrder->updateOrder();
                
    $this->email->from('admin@7com.cphoster.com','Admin');
                
    $this->email->to('yonghan79@gmail.com');
                
    $this->email->subject('Testing email class');
                
    $this->email->message('Status order '.$status);
                
    $this->email->send();
                
    //return $result;
                
    $this->session->set_flashdata('message','Berhasil update order');
                
    redirect('admin/order/index','refresh');
                }
                else
                {
                
    $this->MOrder->updateOrder();
                
    $this->session->set_flashdata('message','Berhasil update order');
                
    redirect('admin/order/index','refresh');
                }
            } 
    model/morder
    Code:
    function updateOrder()
    {
    $sql="update orders set modified=now(),status='".$_POST['status']."'where id='".$_POST['id']."'";
    $this->db->query($sql);

    What i'm trying to do is to show the updated modified to the td as soon as i've updated the status.How should i do it?Thanks a lot guys...
    Last edited by yonghan; 10-28-2009 at 08:45 PM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Load RDF data
    By priyam_maheshwari in forum Java Help
    Replies: 2
    Last Post: 06-28-2011, 03:15 AM
  2. Load a file and display data in a richTextBox
    By Bongkerz in forum C# Programming
    Replies: 0
    Last Post: 12-16-2010, 04:26 AM
  3. Load / save data from text file
    By wazofski in forum Visual Basic Programming
    Replies: 20
    Last Post: 11-14-2010, 10:10 AM
  4. Multilanguage data (PHP data in MySQL table)
    By Thevenin in forum Database & Database Programming
    Replies: 0
    Last Post: 02-17-2010, 07:03 AM
  5. Save/Load Data?
    By slovig in forum Visual Basic Programming
    Replies: 2
    Last Post: 03-04-2008, 03:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts