Checking for empty string - long

From: Date: Tue, 27 Mar 2001 19:46:17 +0000
Subject: Checking for empty string - long
Groups: php.db 
Request: Send a blank email to php-db+get-7907@lists.php.net to get a copy of this message
Thanks for all suggestions to my earlier questions. This time I'm totally stuck though. I've been trying various solutions for over a day now. How do I check for an empty string in PHP/MySQL. Scenario: I have two query returning different results not necessarily of equal length: $queryjobs1 = "SELECT ticket.t_id, t_client, t_summary, e_assignedto, e_status FROM ticket, events "; $queryjobs1 .="WHERE e_assignedto = '$user' AND e_status = 'OPEN' AND ticket.t_id = events.t_id"; $jobresult1 = mysql_query($queryjobs1, $mysql_link) or die("query failed, " . mysql_error()); Which brings up a list of open tickets. $queryjobs2 = "SELECT ticket.t_id, t_client, t_summary, e_assignedto, e_status FROM ticket, events "; $queryjobs2 .="WHERE e_status = 'CLOSED' AND ticket.t_id = events.t_id"; $jobresult2 = mysql_query($queryjobs2, $mysql_link) or die("query failed, " . mysql_error()); Which brings up a list of closed tickets. I then want to compare these to each other to print only the open tickets: <? if ($jobresult1) { //if there are jobs for the user print "<b>Your unresolved ticket(-s)</b>"; print "<table>"; //build a table to show them print "<tr bgcolor='lightGray'><td>Ticket</td><td>Client</td><td>Task</td></tr>"; while($summary=mysql_fetch_row($jobresult1)) { //while there are //open tickets $ticket = $summary[0]; //get a list of //openedt // tickets. $client = $summary[1]; $work = $summary[2]; echo - $ticket; //debug line - prints "- ticket_ID" while($summary2=mysql_fetch_row($jobresult2)) { // get list of closed //tickets // now circle through a list of closed tickets $ticketclosed = $summary2[0]; echo $ticketclosed; // debug line prints "ticket_ID" if ($ticket <> $ticketclosed) { //as //long as we don't get a match // we're //looking for open tickets not closed. print "<tr><td>$ticket</td><td>$client</td><td>$work</td></td>"; //print the ticket } } } print "</table>"; } ?> This print (with one open and one closed ticket) -11-2 (se above) but the second compare fails as open ticket 2 isn't compared to anything and won't print. How do I put in a "catch empty string" statement. It should be fairly simple but it escapes me right now. Any suggestions? M.

« previous php.db (#7907) next »