Hi
I am using the if…else statement to help me to solve some queries.
Here’s the code:
/////////////////////
///
/// LATEST DATA
///
/////////////////////
while ($row_export = mysql_fetch_array($result_export, MYSQL_ASSOC))
{
/////////////////////////////////
/// OPTION 1
/// DATABASE ON EXISTING TABLE
///
/////////////////////////////////
$sql_test = "SELECT *
FROM wsdevice ";
if (trim($pib_bracket_num) !='' and trim($HW_design) !='' )
{
$sql_test .=" WHERE ((wsdevice_pibid like '%$pib_bracket_num%') and
(device_designid = '$HW_design')) ";
$results = mysql_query($sql_test)
or die ("NO SEARCH TERMS");
//echo $results ;
while ($row = mysql_fetch_array($results, MYSQL_ASSOC))
{
/////////////////////////////////
/// OPTION 2
/// DISPLAY EXISTING DATA IN
/// TABLE FORM
/////////////////////////////////
/////////////////////////////////
///
/// DISPLAY UPDATE ON LATEST DATA
/// IN TABLE FORM
/////////////////////////////////
}
} else
{
echo $HW_dev_num;
/////////////////////////////////
/// OPTION 3
/// DISPLAY LATEST DATA NOT UPDATED
///
/////////////////////////////////
}
}
Just wondering if there’s any code i can use in order to satisfy the query statement whereby if $sql_test .=" WHERE ((wsdevice_pibid like ‘%$pib_bracket_num%’) and (device_designid = ‘$HW_design’)) "; is true, it will proceed to option 2 and if it doesn’t satisfy the query, it will move to option 3 ?