0

this is showing all result

but i want to show only if pserialno row is here then it will be show

how can i do this please help me

$result1 = mysql_query("SELECT * FROM workorder where  opendate BETWEEN '$a' AND '$b' order by opendate ASC");
                while($row = mysql_fetch_array($result1))
                {   



                // echo out the contents of each row into a table
                echo "<tr>";
                echo '<td>' . $row['opendate'] . '</td>';
                echo '<td>' . $row['number'] . '</td>';
                echo '<td>' . $row['pserialno'] . '</td>';
msalman
  • 981
  • 1
  • 11
  • 12
  • Check this out (prepared statements are cool): http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php?rq=1 – speccode Nov 08 '13 at 07:47
  • 1
    What exactly do you mean by *if `pserialno` row is here*? Is it not NULL, not an empty string, equals to something ...? – peterm Nov 08 '13 at 07:50
  • **pserialno** is a column in **workorder** table. It will always be there if you SELECT * – Artur Nov 08 '13 at 07:51

1 Answers1

0

but i want to show only if pserialno row is here then it will be show

Just append your WHERE clause to return only those results where pserialno is not blank.

SELECT * FROM workorder where  opendate BETWEEN '$a' AND '$b'
AND pserialno <> ""
ORDER BY opendate ASC
Hanky Panky
  • 46,730
  • 8
  • 72
  • 95