Okay, so I've got this app pretty functional, except one feature I can't seem to figure out how to add. I want to generate a column in the table with the text 'features' in it if either one of two fields in any of the resulting rows is not null. Also I want to have in my table body filling code a section that says 'if this field = x than echo y. I know this should be easy, but I don't know how to break out of printf to write that if statement and then come back in. anyway if someone could look at the code below I would greatly appreciate it. Thank you-Jake

P.S. I put a line of ////////// where the issues are, you can see my meager attempts.


require("common.php3") ;
if (!($link = mysql_pconnect($host, $user, $password))){
echo "<BR>Not connected<BR>";}
if (!(mysql_select_db($db))){
echo "<BR>not selected<BR>";}
$searchStmt = "SELECT * FROM $table WHERE ";
if ($cap)
$searchStmt .= "cap <= '$cap' AND " ;
if ($man)
$searchStmt .= "man LIKE "$man" and ";
if ($res)
$searchStmt .= "res >= '$res' and ";
if ($typeid)
$searchStmt .= "typeid= '$typeid' and ";
if ($lft){
$searchStmt .= "lft = 'l' and "; }
if ($carat){
$searchStmt .= "carat = 'c' and ";}

$prestmt =substr($searchStmt, 0, strlen($searchStmt)-4);
$stmt = ($prestmt .= ";");
$stmt = stripSlashes($stmt) ;
$result = mysql_db_query($db,$stmt, $link);
if ($result == 0){
echo("<B>Error " . mysql_errno() . ": " . mysql_error() . "</B>");
}elseif (mysql_num_rows($result) == 0){
echo("<B>Query executed successfully!</B>");} ?>
printf ("<TABLE WIDTH="600px" NOSAVE>n");
printf ("<TR align="center" BGCOLOR="#bdc6de">
if ($lftyes == "true" or $caratyes == "true"){
</TR>n<TR><td colspan="7"><HR></td></TR>");

while (($row = mysql_fetch_array($result))){
printf("<TR class="mytext" align="center">
<TD><IMG src="../allimg/%s"></TD>
<TD class="mytextup">%s</TD>
<TD class="mytextup"><A HREF="%s">%s</A></TD>
<TD class="mytextup"><B>Capacity:</B><BR><IMG src="shim.gif width = "25" height = "10">%sg<BR><B>Accuracy:</B><BR><IMG src="shim.gif width = "25" height = "10">%sg</TD>
<TD class="mytextup">MSRP=$%s<BR><font color="#CC0000"> Our Price:$%s</FONT></TD>
<TD class="mytextup"><img src="%s.gif"><img src="%s.gif"></TD>;
<TD class="mytext" align="left"><IMG src="shim.gif width = "25" height = "10">%s</TD>n",
printf("</TABLE>n<BR><A HREF="typeselect.php3"> New search</A>");?>