SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help in combine empty and not empty data.

    Hi,

    Can anyone help me how to implement this idea i'am lost with this one..

    i have two script for two different function but my boss want to combine this two idea but i'am lost how to encode this or to query it.

    below script is the one i want to use for the combination of the script and also the output for the first image.i have attach an image for anyone that can give me an idea.thanks very much..
    Code PHP:
    <?php
    session_start();
    include_once("conn.php");
    if(isset($_SESSION['username'])){
     
      $pendtickets = array();
     
    	 $selectTicketsQuery = mssql_query("Select * from tblTicket inner join tblAssign on tblTicket.TickNo=tblAssign.TicketNo where tblTicket.Status='Open' and tblAssign .AssignTo!= '$_SESSION[username]'");
    	 while($pendticket = mssql_fetch_array($selectTicketsQuery)){
            $pendtickets[] = $pendticket;
    		}
     
     
    ?>
    	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    	<html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<link href="css/mystyle.css" rel="stylesheet" type="text/css"/>
    		<link rel="stylesheet" href="css/table sorter.css" type="text/css" media="print, projection, screen">
    		<script type="text/javascript" src="jquery/jquery-1.2.6.min.js"></script>
    		<script type="text/javascript" src="jquery/jquery.tablesorter.js"></script> 
    		<script type="text/javascript" src="jquery/jquery.quicksearch.js"></script>
    		<script type="text/javascript" src="jquery/tablesort.js"></script>  
     
    		<style type="text/css">    
    			div.quicksearch 
    			{              
    			  padding-bottom: 10px;      
    			}
    		</style>
     
     
     
    	</head>
     
    	<body>	
     
    	<center>
    	<fieldset class='viewuser'>
     
    	<br/>
    	<legend>Pending Ticket</legend>
     
    		<table id="tableOne" class="yui">
    			<thead>
    				<tr>
    					<th><a href='#'>Ticket No.</a></th>
    					<th><a href='#'>Create By</a></th>
    					<th><a href='#'>Create Date</a></th>
    					<th><a href='#'>Create Time</a></th>
    					<th><a href='#'>Problem Description</a></th>
    					<th><a href='#'>Assign To</a></th>
     
    				</tr>
    			</thead>
    			<tbody>			
    					<?php   foreach($pendtickets as $pendticket){
    						echo '<tr>';
    							echo '<td>',$pendticket['TicketNo'],'</td>';
    							echo '<td>',$pendticket['UserName'],'</td>';
    							echo '<td>',$pendticket['DateCreate'],'</td>';
    							echo '<td>',$pendticket['TimeCreate'],'</td>';
    							echo '<td>',$pendticket['Category']." (".$pendticket['Subcat'].")",'</td>';
     
    							echo '<td>',$pendticket['AssignTo'],'</td>';
     
    							echo "<td><a href='grabticket.php?idnum={$pendticket['TicketNo']}'>Grab Ticket</a></td>";
     
    						echo '</tr>';
    					} ?>
    			</tbody>
    				<tfoot align='left'>
    					<tr style="display:none;">
    						<td colspan="6">No rows match the filter...</td>
    				</tr>	    
    			</tfoot>			
    		</table>
     
    	</fieldset>
    	</center>
    	</body>
    	<?php/*
    }else{
    echo "<h1 align='center'><font color='#ff0000'>No Pending Ticket</font><h1>";}
    */?>
    	</html>
    <?php
     
    }else{ //not logged in
        header('location: login.php');
    }
    ?>
    Attached Files Attached Files

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    I'm confused by what you're trying to do. Combine what? I see a picture of two table entries.

  3. #3
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think he wants the same page to show tickets that already have been assigned to someone as well as unassigned ones in a single table.
    Smells like a sql question...
    zbing

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    If that's what he's asking, then yes, it is an SQL question, and he'll be needing a LEFT (or RIGHT) JOIN.

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i just figure it out..sorry for the confusion..it is just another query with-in the table..


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
  •