Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Possible JQuery

  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Possible JQuery

    I'm not sure if this is something jquery can do or what but here's what I want to do but I have this following code and when it shows either Public or Archived for the Event Status I want it to be a link so that if I click on Public then it turn it into Archived because it'll change its status_id in the DB from 4 to 5.

    PHP Code:
    case 1:
                echo $e;
                ?>
                <h1 class=backstage>Archiving Management</h1><br />
                <h2 class=backstage>Weekly Events</h2><br />
                    
                    <?php
                    $query 
    "SELECT ecb.bookingdate, els.name, ele.statusname, ecb.label FROM `efed_content_booking` AS ecb LEFT JOIN `efed_list_shownames` AS els  ON ( ecb.event_id = els.id ) LEFT JOIN `efed_list_eventstatus`  AS ele ON ( ecb.status_id = ele.id ) WHERE els.type = 'singular' OR els.type = 'recurring'"
                    
                    
    $result mysql_query $query ); 
                    
    $rows mysql_num_rows($result);
                    if (
    $rows 0)  {
                    print
    '<table width="100%" class="table1">
                        <tr class="rowheading">
                            <td>Event</td>
                            <td align="center">Booking Date</td>
                            <td align="center">Event Status</td>
                        </tr>'
    ;
                    
    $i 0;
                    while ( 
    $row mysql_fetch_array($resultMYSQL_ASSOC) ) {
                        
    $sClass 'row2';
                        if (
    $i++ % 2$sClass 'row1';
                        
    printf "<tr class=\"%s\">"$sClass );
                        
    printf "<td valign=\"top\">%s%s</td>"$row['name'],$row['label'] );  
                        
    printf "<td valign=\"top\" align=\"center\">%s</td>"convertdate($row['bookingdate'] ));
                        
    printf "<td valign=\"top\" align=\"center\">%s</td>"$row['statusname'] );
                        echo 
    '</tr>';
                     }
                    echo 
    '</table><br>';
                } else {
                    echo 
    '<span>There are no weekly events to archive.</span><br /><br />';
                }
                
    ?>
                    <h2 class=backstage>Pay-Per-View Events</h2><br />
                    
                    <?php
                    $query 
    "SELECT ecb.bookingdate, els.name, ele.statusname, ecb.label FROM `efed_content_booking` AS ecb LEFT JOIN `efed_list_shownames` AS els  ON ( ecb.event_id = els.id ) LEFT JOIN `efed_list_eventstatus`  AS ele ON ( ecb.status_id = ele.id ) WHERE els.type = 'ppv'"
                    
                    
    $result mysql_query $query ); 
                    
    $rows mysql_num_rows($result);
                    if (
    $rows 0)  {
                    print
    '<table width="100%" class="table1">
                        <tr class="rowheading">
                            <td>Event</td>
                            <td align="center">Booking Date</td>
                            <td align="center">Event Status</td>
                        </tr>'
    ;
                    
    $i 0;
                    while ( 
    $row mysql_fetch_array($resultMYSQL_ASSOC) ) {
                        
    $sClass 'row2';
                        if (
    $i++ % 2$sClass 'row1';
                        
    printf "<tr class=\"%s\">"$sClass );
                        
    printf "<td valign=\"top\">%s%s</td>"$row['name'],$row['label'] );
                        
    printf "<td valign=\"top\" align=\"center\">%s</td>"convertdate($row['bookingdate']) );
                        
    printf "<td valign=\"top\" align=\"center\">%s</td>"$row['statusname'] );
                        echo 
    '</tr>';
                     }
                    echo 
    '</table><br>';
                } else {
                    echo 
    '<span>There are no ppv events to archive.</span><br /><br />';
                }
                
    returnmain();
                
    footercode();
            break;

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, if javascript can do it, jquery can do it... as jquery is just a javascript framework (before someone yells, I know that's not absolutely true ).

    That being said, you wanna look into AJAX, such as the jquery post method
    http://api.jquery.com/jQuery.post/

    AJAX is how you do a live db change... essentially you call a php (or w/e coding language) page that takes an argument via POST (or GET if you prefer) and works at it. The javascript takes elements of the current page and does a server side request in the background.


  •  

    Posting Permissions

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