Help in combine empty and not empty data


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…


  $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" "">
	<html xmlns="">
		<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">    
			  padding-bottom: 10px;      


	<fieldset class='viewuser'>

	<legend>Pending Ticket</legend>
		<table id="tableOne" class="yui">
					<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>
					<?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>';
					} ?>
				<tfoot align='left'>
					<tr style="display:none;">
						<td colspan="6">No rows match the filter...</td>

echo "<h1 align='center'><font color='#ff0000'>No Pending Ticket</font><h1>";}
}else{ //not logged in
    header('location: login.php');

I’m confused by what you’re trying to do. Combine what? I see a picture of two table entries.

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…

If that’s what he’s asking, then yes, it is an SQL question, and he’ll be needing a LEFT (or RIGHT) JOIN.

i just figure it out…sorry for the confusion…it is just another query with-in the table…