Jump to content

file only returns one search


darkfreaks

Recommended Posts

i have two searches on process.php however it only processes the first one.

 

even if you use the second one? what am i doing wrong here :wtf:

 

first search code

 

// Immediate jump for ref num
$modno = trim($_GET['modno']);
$modno.= isset($_GET['modno']) ? $_GET['modno'] : '';
$modno.= is_numeric($_GET['modno']) ? $_GET['modno'] : 0;
$SQLstmt="SELECT * FROM tblModel,tblImages";
$SQLstmt .= " WHERE tblModel.modelNo = $modno";  
$SQLstmt .= " AND tblModel.modelID = tblImages.modelID";

    $db=mysql_query($SQLstmt,$oConn) or die(mysql_error());
  

if (mysql_num_rows($db)==0)
{

  $countData="No results found of selected query"; ?>
				<tr>
					<td colspan="5" class="text9"><br>  <strong>Search Result</strong> </td>
				</tr>
                    <tr>
                        <td class="text" colspan="4">  <?   echo $countData; echo $db;
                        echo mysql_num_rows($db);
?></td>
                    </tr>
                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>			
<? 
}
  else
{
?><table width="100%" align="center" cellpadding="0" cellspacing="0">
                                            <tr><td class="text9"><br><strong>Search Result</strong></td><td colspan="3" align="right"></td></tr>
                                            <tr> 
                                              <td width="150" class="text"><div align="center"><strong>Thumbnail</strong></div></td>
                                              <td width="150" class="text"><strong>Model 
                                                No</strong></td>
                                              <td width="75"></td>
                                </tr>
							                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>
                    
                                            <tr> 
<? 


while ($line = mysql_fetch_array($db)){
?>
                                              <td class="text"><div align="center"><a href="../models/model.php?modelID=<? echo $line["modelID"]; ?>#"><img src="../cms/models/lineup/<? echo $line["modelID"]; ?>/<? echo $line["imageFile"]; ?>" height="100" width="<? echo $width; ?>" border="0"></a></div></td>
                    
                                              <td width="147" class="text"><?   echo $line["modelNo"]; ?></td>
                                              <td width="78" class="text"><a href="../models/model.php?modelID=<?     echo $line["modelID"]; ?>#">View</a></td>
</tr>
                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>
     <? 
}



?> 
</table></td> 
			                        
<? } ?>	 

			 </tr>
				  </table></font>
				  </td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>                  
			  </tr>
                </table>
            </td>
          </tr>
                    
        </table>
      
    </div><!--// news-box //-->
    </div><!--// news-story-container //-->
    </div><!--// news-container //-->

	</div> <!-- eof content -->

</div> <!-- eof main -->

</div> <!-- eof wrap -->

<div id="footer">

</div> <!-- eof footer -->
</body>
</html>

<? $db=null; ?>

Link to comment
Share on other sites

I don't know what you mean by "first and second one".

 

But, I do see a problem in your code. At the top, you need to be reassigning $modno and not adding to its value. Also, you are calling trim() before you check if it exists - if it doesn't exist you're going to get an error. You can use typecasting here and make the code a bit simpler.

$modno = (int) (isset($_GET['modno']) ? $_GET['modno'] : 0);

Link to comment
Share on other sites

i tried adding int and yes im using trim in $modno

 

 

here is the full code

 

 

<?php 

include "../inc/conf.php";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../active.css" rel="stylesheet" type="text/css" />
<!--[if !IE 7]>
<style type="text/css">
	#wrap {display:table;height:100%}
</style>
<![endif]-->
<script type="text/javascript" src="../inc/c_config.js"></script>
<script type="text/javascript" src="../inc/c_smartmenus.js"></script>

<script language="JavaScript" src="../css/script.js" type="text/JavaScript"></script>

<script language="JavaScript" src="../inc/validation.js" type="text/JavaScript"></script>

<script language="JavaScript" type="text/JavaScript">

function form_onsubmit(type)

{

  var form = document.form;

  var returnValue = false;  





  if (form.email.value == "")

  { 

     alert("Please ENTER your email");

     form.email.focus();

  }

  

  else if (!validEmail(form.email,"E-mail",true))

	return false;



  else

  {

     returnValue = true;

 MM_openBrWindow('../mailinglist.php?type='+type+'&email='+form.email.value,'mailing','scrollbars=yes,width=195,height=185')

   } 

  return returnValue;

}

</script>


</head>

<body>
<div id="wrap">
<div id="header">

</div> <!-- eof header -->
    
    	<div id="menu">

        php INCLUDE "../inc/newmenu.php" ?>

</div> <!-- eof menu -->
    
<div id="main">

	<div id="left">
        
        <div class="column-box-header">
      <h1 class="column-box-header-text">
        Models By Category
      </h1>
    </div>
    <div class="column-box">
      <div class="column-box-content">
      
      <table>
      <tr> 
      <td style="height: 10px;"></td>
      </tr>
      <tr> 
      <td class="textheading"><a href="../models/index.php?cat=1">Male models</a></td>
      </tr>
      <tr> 
      <td class="textheading">Female Models</td>
      </tr>
      <tr> 
      <td class="text"><a href="../models/index.php?subcat=1">  -Solo American</a></td>
      </tr>
      <tr> 
      <td class="text"><a href="../models/index.php?subcat=2">  -Artistic Nude</a></td>
      </tr>
      <tr> 
      <td class="text"><a href="../models/index.php?subcat=4">  -Girl Girl Soft</a></td>
      </tr>
      <tr> 
      <td class="text"><a href="../models/index.php?subcat=6">  -Girl Girl XXX</a></td>
      </tr>
      <tr> 
      <td class="text"><a href="../models/index.php?subcat=3">  -Boy Girl Soft</a></td>
      </tr>
      <tr> 
      <td class="text"><a href="../models/index.php?subcat=5">  -Boy Girl All</a></td>
      </tr>
      <tr> 
      <td class="textheading"><a href="../models/index.php?cat=4">Couples</a></td>
      </tr>
      </table>
        
      </div>
      
    </div><!--// column-box //-->
        
        <div class="column-box-header">
      <h1 class="column-box-header-text">
        Model Of The Month
      </h1>
    </div>
    <div class="column-box">
      <div class="column-box-content">
      <?php $i=0;

$SQLF=" SELECT tblFeature.FeatureModel, tblFeature.modelID, tblModel.modelID, tblFeature.imageFile, tblFeature.featureRemarks, tblModel.modelStatus ";

$SQLF=$SQLF." FROM tblFeature INNER JOIN tblModel ON tblFeature.modelID = tblModel.modelID WHERE tblFeature.FeatureModel =1 AND tblModel.modelStatus<>'Offline' ";

$rs=mysql_query($SQLF);

?>
        <div id="modelImgTd"><a href="../models/model.php?modelID=php echo mysql_result($rs,$i,"modelID"); ?>"><img src="../cms/models/feature/php print mysql_result($rs,$i,"imagefile"); ?>" width="120" border="0" align="center"></a></div>
        
        <p class="column-box-text"> php echo mysql_result($rs,$i,"featureRemarks"); ?></p>
        
      </div>
      <div class="column-box-footer">
        <div class="column-box-footer-text">
          <a href="../models/model.php?modelID=php echo mysql_result($rs,$i,"modelID"); ?>">
            More Info
            <img class="go-button-s2" src="../imgs/go_button.png" alt="" />
          </a>
        </div>
      </div>
    </div><!--// column-box //-->
    
    <div class="column-box-header">
      <h1 class="column-box-header-text">
        Mailing List
      </h1>
    </div>
    <div class="column-box">
      <div class="column-box-content">
      <form name=form>
       
        <p class="column-box-text">Enter Email Address</p>
        <input name="email" type="text" class="textbox" size="25">
        <a href="javascript:;" onClick="return form_onsubmit('add');"><img src="../images/add.gif" border="0"></a> <a href="javascript:;" onClick="return form_onsubmit('delete');"><img src="../images/remove.gif" border="0"></a>
        </form>
      </div>
    </div><!--// column-box //-->

	</div> <!-- eof left -->
        
        <div id="content">
        
         <div id="news-bar">
      <h1 id="news-bar-text">
        Model Search
      </h1>
    </div>

    <div id="news-container">
    <div id="news-story-container"> 
  <div class="news-box">
      
      <table width="100%" align="center" cellpadding="0" cellspacing="0">
                                      <tr>
					                <td width="675px" valign="top"> 
                                         <?php 
//===========request.form checkboxes===================

$checkbox=$_POST["checkbox"];
//============use for search recordset paging================

if (strlen($_GET["cb1"])!=0)
{

  $checkbox=$_GET["cb1"];
} 

//===========================================================

if ($checkbox=="1")
{

  $checkboxDisplay=" and tblModel.A_FN =".$checkbox;
}
  else
{

  $checkboxDisplay=" ";
} 


$checkbox2=$_POST["checkbox2"];
//============use for search recordset paging================

if (strlen($_GET["cb2"])!=0)
{

  $checkbox2=$_GET["cb2"];
} 

//===========================================================

if ($checkbox2=="1")
{

  $checkbox2Display=" and TS =".$checkbox2;

}
  else
{

  $checkbox2Display=" ";
} 


$checkbox3=$_POST["checkbox3"];
//============use for search recordset paging================

if (strlen($_GET["cb3"])!=0)
{

  $checkbox3=$_GET["cb3"];
} 

//===========================================================

if ($checkbox3=="1")
{

  $checkbox3Display=" and CON =".$checkbox3;
}
  else
{

  $checkbox3Display=" ";
} 


$checkbox4=$_POST["checkbox4"];
//============use for search recordset paging================

if (strlen($_GET["cb4"])!=0)
{

  $checkbox4=$_GET["cb4"];
} 

//===========================================================

if ($checkbox4=="1")
{

  $checkbox4Display=" and STI =".$checkbox4;
}
  else
{

  $checkbox4Display=" ";
} 


$checkbox5=$_POST["checkbox5"];
//============use for search recordset paging================

if (strlen($_GET["cb5"])!=0)
{

  $checkbox5=$_GET["cb5"];
} 

//===========================================================

if ($checkbox5=="1")
{

  $checkbox5Display=" and FA =".$checkbox5;
}
  else
{

  $checkbox5Display=" ";
} 


$checkbox6=$_POST["checkbox6"];
//============use for search recordset paging================

if (strlen($_GET["cb6"])!=0)
{

  $checkbox6=$_GET["cb6"];
} 

//===========================================================

if ($checkbox6=="1")
{

  $checkbox6Display=" and VID =".$checkbox6;
}
  else
{

  $checkbox6Display=" ";
} 


$checkbox7=$_POST["checkbox7"];
//============use for search recordset paging================

if (strlen($_GET["cb7"])!=0)
{

  $checkbox7=$_GET["cb7"];
} 

//===========================================================

if ($checkbox7=="1")
{

  $checkbox7Display=" and BGS =".$checkbox7;
}
  else
{

  $checkbox7Display=" ";
} 


$checkbox8=$_POST["checkbox8"];
//============use for search recordset paging================

if (strlen($_GET["cb8"])!=0)
{

  $checkbox8=$_GET["cb8"];
} 

//===========================================================

if ($checkbox8=="1")
{

  $checkbox8Display=" and GGS =".$checkbox8;
}
  else
{

  $checkbox8Display=" ";
} 


$checkbox9=$_POST["checkbox9"];
//============use for search recordset paging================

if (strlen($_GET["cb9"])!=0)
{

  $checkbox9=$_GET["cb9"];
} 

//===========================================================

if ($checkbox9=="1")
{

  $checkbox9Display=" and BGX =".$checkbox9;
}
  else
{

  $checkbox9Display=" ";
} 


$checkbox10=$_POST["checkbox10"];
//============use for search recordset paging================

if (strlen($_GET["cb10"])!=0)
{

  $checkbox10=$_GET["cb10"];
} 

//===========================================================

if ($checkbox10=="1")
{

  $checkbox10Display=" and GGX =".$checkbox10;
}
  else
{

  $checkbox10Display=" ";
} 

//=========== end of request.form checkboxes===========

//===========calculate each range of height============

$height=str_replace("'","''",$_POST["txtHeight"]);
//============use for search recordset paging================

if (strlen($_GET["height"])!=0)
{

  $height=$_GET["height"];
} 

//===========================================================

if ($height=="heightA")
{

  $rangeHeight="BETWEEN '4' AND '5'";
  $heightDisplay=" and modelHeight ".$rangeHeight." ";
}
  else
if ($height=="heightB")
{

  $rangeHeight="BETWEEN '5' AND '6'";
  $heightDisplay=" and modelHeight ".$rangeHeight." ";
}
  else
if ($height=="heightC")
{

  $rangeHeight="BETWEEN '6' AND '7'";
  $heightDisplay=" and modelHeight ".$rangeHeight." ";
}
  else
{

  $rangeHeight=" ";
  $heightDisplay=$rangeHeight;
} 

//===========end of range calculation==================

//===========calculate modelLocation ==================

$location=str_replace("'","''",$_POST["txtLocation"]);
//============use for search recordset paging================

if (strlen($_GET["location"])!=0)
{

  $location=$_GET["location"];
} 

//===========================================================

if ($location!="")
{

  $locationDisplay=" and modelLocation like '%".$location."' ";
}
  else
{

  $locationDisplay=" ";
} 


$hair=str_replace("'","''",$_POST["txtHair"]);
//============use for search recordset paging================

if (strlen($_GET["hair"])!=0)
{

  $hair=$_GET["hair"];
} 

//===========================================================

if ($hair!="")
{

  $hairDisplay=" and modelHair like '%".$hair."%' ";
}
  else
{

  $hairDisplay=" ";
} 


//==========calculate each range of bust size =========

$bSize=str_replace("'","''",$_POST["txtBust"]);
//============use for search recordset paging================

if (strlen($_GET["bSize"])!=0)
{

  $bSize=$_GET["bSize"];
} 

//===========================================================

if ($bSize=="bustA")
{

  $rangeBust="BETWEEN '20' AND '24'";
  $bustDisplay=" and modelSize ".$rangeBust." ";
}
  else
if ($bSize=="bustB")
{

  $rangeBust="BETWEEN '25' AND '29'";
  $bustDisplay=" and modelSize ".$rangeBust." ";
}
  else
if ($bSize=="bustC")
{

  $rangeBust="BETWEEN '30' AND '34'";
  $bustDisplay=" and modelSize ".$rangeBust." ";
}
  else
if ($bSize=="bustD")
{

  $rangeBust="BETWEEN '35' AND '39'";
  $bustDisplay=" and modelSize ".$rangeBust." ";
}
  else
if ($bSize=="bustE")
{

  $rangeBust="BETWEEN '40' AND '44'";
  $bustDisplay=" and modelSize ".$rangeBust." ";
}
  else
if ($bSize=="bustF")
{

  $rangeBust="BETWEEN '45' AND '49'";
  $bustDisplay=" and modelSize ".$rangeBust." ";
}
  else
if ($bSize=="bustG")
{

  $rangeBust="> '50'";
  $bustDisplay=" and modelSize ".$rangeBust." ";
}
  else
{

  $rangeBust=" ";
  $bustDisplay=$rangeBust;
} 

//==========end of bust size range=====================

//==========calculate each range of ages===============

$age=str_replace("'","''",$_POST["txtAge"]);
//============use for search recordset paging================

if (strlen($_GET["age"])!=0)
{

  $age=$_GET["age"];
} 

//===========================================================

if ($age=="ageA")
{

  $rangeAge="BETWEEN '18' AND '24'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageB")
{

  $rangeAge="BETWEEN '25' AND '29'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageC")
{

  $rangeAge="BETWEEN '30' AND '34'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageD")
{

  $rangeAge="BETWEEN '35' AND '39'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageE")
{

  $rangeAge="BETWEEN '40' AND '44'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageF")
{

  $rangeAge="BETWEEN '45' AND '49'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageG")
{

  $rangeAge="BETWEEN '50' AND '54'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageH")
{

  $rangeAge="BETWEEN '55' AND '59'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
if ($age=="ageI")
{

  $rangeAge="> '60'";
  $ageDisplay=" and modelAge ".$rangeAge." ";
}
  else
{

  $rangeAge=" ";
  $ageDisplay=$rangeAge;
} 

//=========end of range of ages===================

$eye=str_replace("'","''",$_POST["txtColour"]);
//============use for search recordset paging================

if (strlen($_GET["eye"])!=0)
{

  $eye=$_GET["eye"];
} 

//===========================================================

if ($eye!="")
{

  $eyeDisplay=" and modelEyeColour like '%".$eye."%' ";
}
  else
{

  $eyeDisplay=" ";
} 


//============calculate range of waist ==============

$waist=str_replace("'","''",$_POST["txtWaist"]);
//============use for search recordset paging================

if (strlen($_GET["waist"])!=0)
{

  $waist=$_GET["waist"];
} 

//===========================================================

if ($waist=="waistA")
{

  $rangeWaist="BETWEEN '20' AND '24'";
  $waistDisplay=" and modelWaist ".$rangeWaist." ";
}
  else
if ($waist=="waistB")
{

  $rangeWaist="BETWEEN '25' AND '29'";
  $waistDisplay=" and modelWaist ".$rangeWaist." ";
}
  else
if ($waist=="waistC")
{

  $rangeWaist="BETWEEN '30' AND '34'";
  $waistDisplay=" and modelWaist ".$rangeWaist." ";
}
  else
if ($waist=="waistD")
{

  $rangeWaist="BETWEEN '35' AND '39'";
  $waistDisplay=" and modelWaist ".$rangeWaist." ";
}
  else
if ($waist=="waistE")
{

  $rangeWaist="BETWEEN '40' AND '44'";
  $waistDisplay=" and modelWaist ".$rangeWaist." ";
}
  else
if ($waist=="waistF")
{

  $rangeWaist="BETWEEN '45' AND '49'";
  $waistDisplay=" and modelWaist ".$rangeWaist." ";
}
  else
if ($waist=="waistG")
{

  $rangeWaist=">'50'";
  $waistDisplay=" and modelWaist ".$rangeWaist." ";
}
  else
{

  $rangeWaist=" ";
  $waistDisplay=$rangeWaist;
} 

//============end of range of waist ==============

//============calculate range of dress ===========

$dSize=str_replace("'","''",$_POST["txtDress"]);
//============use for search recordset paging================

if (strlen($_GET["dSize"])!=0)
{

  $dSize=$_GET["dSize"];
} 

//===========================================================

if ($dSize=="dressA")
{

  $rangeDress="BETWEEN '0' AND '4'";
  $dressDisplay=" and modelDressSize ".$rangeDress." ";
}
  else
if ($dSize=="dressB")
{

  $rangeDress="BETWEEN '5' AND '9'";
  $dressDisplay=" and modelDressSize ".$rangeDress." ";
}
  else
if ($dSize=="dressC")
{

  $rangeDress="BETWEEN '10' AND '14'";
  $dressDisplay=" and modelDressSize ".$rangeDress." ";
}
  else
if ($dSize=="dressD")
{

  $rangeDress="BETWEEN '15' AND '19'";
  $dressDisplay=" and modelDressSize ".$rangeDress." ";
}
  else
if ($dSize=="dressE")
{

  $rangeDress="BETWEEN '20' AND '24'";
  $dressDisplay=" and modelDressSize ".$rangeDress." ";
}
  else
if ($dSize=="dressF")
{

  $rangeDress="BETWEEN '25' AND '29'";
  $dressDisplay=" and modelDressSize ".$rangeDress." ";
}
  else
if ($dSize=="dressG")
{

  $rangeDress=">30";
  $dressDisplay=" and modelDressSize ".$rangeDress." ";
}
  else
{

  $rangeDress=" ";
  $dressDisplay=" ".$rangeDress." ";
} 

//============end of range of dress ==============

$race=str_replace("'","''",$_POST["txtRace"]);
//============use for search recordset paging================

if (strlen($_GET["race"])!=0)
{

  $race=$_GET["race"];
} 

//===========================================================

if ($race!="")
{

  $raceDisplay=" and modelRace like '".$race."%' ";
}
  else
{

  $raceDisplay=" ";
} 

//============calculate range of hips=============

$hips=str_replace("'","''",$_POST["txtHips"]);
//============use for search recordset paging================

if (strlen($_GET["hips"])!=0)
{

  $hips=$_GET["hips"];
} 

//===========================================================

//hips = request.QueryString("hips")

if ($hips=="hipsA")
{

  $hipsRange="BETWEEN '25' AND '29'";
  $hipsDisplay=" and modelHips ".$hipsRange." ";
}
  else
if ($hips=="hipsB")
{

  $hipsRange="BETWEEN '30' AND '34'";
  $hipsDisplay=" and modelHips ".$hipsRange." ";
}
  else
if ($hips=="hipsC")
{

  $hipsRange="BETWEEN '35' AND '39'";
  $hipsDisplay=" and modelHips ".$hipsRange." ";
}
  else
if ($hips=="hipsD")
{

  $hipsRange="BETWEEN '40' AND '44'";
  $hipsDisplay=" and modelHips ".$hipsRange." ";
}
  else
if ($hips=="hipsE")
{

  $hipsRange="BETWEEN '45' AND '49'";
  $hipsDisplay=" and modelHips ".$hipsRange." ";
}
  else
if ($hips=="hipsF")
{

  $hipsRange="> '50'";
  $hipsDisplay=" and modelHips ".$hipsRange." ";
}
  else
{

  $hipsRange=" ";
  $hipsDisplay=" ".$hipsRange." ";
} 

//============end of hips calculation=============

//============calculate range of shoes============

$sSize=str_replace("'","''",$_POST["txtShoe"]);
//============use for search recordset paging================

if (strlen($_GET["sSize"])!=0)
{

  $sSize=$_GET["sSize"];
} 

//===========================================================

if ($sSize=="shoeA")
{

  $shoeRange="BETWEEN '0' AND '4'";
  $shoeDisplay=" and modelShoeSize ".$shoeRange." ";
}
  else
if ($sSize=="shoeB")
{

  $shoeRange="BETWEEN '5' AND '9'";
  $shoeDisplay=" and modelShoeSize ".$shoeRange." ";
}
  else
if ($sSize=="shoeC")
{

  $shoeRange="BETWEEN '10' AND '14'";
  $shoeDisplay=" and modelShoeSize ".$shoeRange." ";
}
  else
if ($sSize=="shoeD")
{

  $shoeRange="BETWEEN '15' AND '19'";
  $shoeDisplay=" and modelShoeSize ".$shoeRange." ";
}
  else
if ($sSize=="shoeE")
{

  $shoeRange=">'20'";
  $shoeDisplay=" and modelShoeSize ".$shoeRange." ";
}
  else
{

  $shoeRange=" ";
  $shoeDisplay=" ".$shoeRange." ";
} 
//===============modno search=====================


// Immediate jump for ref num
$modno = trim($_GET['modno']);
$modno.= (int) isset($_GET['modno']) ? $_GET['modno'] : '';
$modno.= is_numeric($_GET['modno']) ? $_GET['modno'] : 0;
$SQLstmt="SELECT * FROM tblModel,tblImages";
$SQLstmt .= " WHERE tblModel.modelNo = $modno";  
$SQLstmt .= " AND tblModel.modelID = tblImages.modelID";

    $db=mysql_query($SQLstmt,$oConn) or die(mysql_error());
  

if (mysql_num_rows($db)==0)
{

  $countData="No results found of selected query"; ?>
				<tr>
					<td colspan="5" class="text9"><br>  <strong>Search Result</strong> </td>
				</tr>
                    <tr>
                        <td class="text" colspan="4">  <?php   echo $countData; echo $db;
                        echo mysql_num_rows($db);
?></td>
                    </tr>
                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>			
<?php 
}
  else
{
?><table width="100%" align="center" cellpadding="0" cellspacing="0">
                                            <tr><td class="text9"><br><strong>Search Result</strong></td><td colspan="3" align="right"></td></tr>
                                            <tr> 
                                              <td width="150" class="text"><div align="center"><strong>Thumbnail</strong></div></td>
                                              <td width="150" class="text"><strong>Model 
                                                No</strong></td>
                                              <td width="75"></td>
                                </tr>
							                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>
                    
                                            <tr> 
<?php 


while ($line = mysql_fetch_array($db)){
?>
                                              <td class="text"><div align="center"><a href="../models/model.php?modelID=php echo $line["modelID"]; ?>#"><img src="../cms/models/lineup/php echo $line["modelID"]; ?>/php echo $line["imageFile"]; ?>" height="100" width="php echo $width; ?>" border="0"></a></div></td>
                    
                                              <td width="147" class="text"><?php   echo $line["modelNo"]; ?></td>
                                              <td width="78" class="text"><a href="../models/model.php?modelID=<?php     echo $line["modelID"]; ?>#">View</a></td>
</tr>
                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>
     <?php 
}



?> 
</table></td> 
			                        
<?php } ?>	 

			 </tr>
				  </table></font>
				  </td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>                  
			  </tr>
                </table>
            </td>
          </tr>
                    
        </table>
      
    </div><!--// news-box //-->
    </div><!--// news-story-container //-->
    </div><!--// news-container //-->

	</div> <!-- eof content -->

</div> <!-- eof main -->

</div> <!-- eof wrap -->

<div id="footer">

</div> <!-- eof footer -->
</body>
</html>

<?php $db=null; ?>









<?php
//============end of calculation==================


$remarks=str_replace("'","''",$_POST["txtRemarks"]);
if ($remarks!="")
{

  $remarksDisplay=" and modelRemarks like '%".$remarks."%' ";
}
  else
{

  $remarksDisplay=" ";
} 


$keyword=str_replace("'","''",$_POST["keyword"]);
$stageName=str_replace("'","''",$_POST["txtStage"]);
if ($stageName!="")
{

  $stageNameDisplay=" and modelName like '%".$stageName."%' ";
}
  else
{

  $stageNameDisplay=" ";
} 

$kategori=str_replace("'","''",$_POST["txtCategory"]);

$abc=substr($kategori,0,12);

if (strlen($_GET["cat"])!=0)
{
  $kategori=$_GET["cat"];
} 
if ($keyword!="")
{
  $SQLstmt=" SELECT * FROM tblModel,tblImages ";
  $SQLstmt=$SQLstmt." WHERE tblModel.modelStatus='Active' ";
  $SQLstmt=$SQLstmt."AND tblImages.imageTypeID = 1 ";
  $SQLstmt=$SQLstmt."AND tblModel.modelName LIKE '%".$keyword."%' ";
  $SQLstmt=$SQLstmt."AND tblModel.modelID = tblImages.modelID ";
  $rs=mysql_query($SQLstmt) or die( "Your search found no matching results");
}
  else
{
  $SQLstmt="Select * from tblModel, tblImages where ";
  $SQLstmt=$SQLstmt."tblModel.modelCategory like '%".$kategori."%' ";
  $SQLstmt=$SQLstmt." ".$stageNameDisplay." ";
  $SQLstmt=$SQLstmt." ".$heightDisplay." ";
  $SQLstmt=$SQLstmt." ".$locationDisplay." ";
  $SQLstmt=$SQLstmt." ".$hairDisplay." ";
  $SQLstmt=$SQLstmt." ".$bustDisplay." ";
  $SQLstmt=$SQLstmt." ".$ageDisplay." ";
  $SQLstmt=$SQLstmt." ".$eyeDisplay." ";
  $SQLstmt=$SQLstmt." ".$waistDisplay." ";
  $SQLstmt=$SQLstmt." ".$dressDisplay." ";
  $SQLstmt=$SQLstmt." ".$raceDisplay." ";
  $SQLstmt=$SQLstmt." ".$hipsDisplay." ";
  $SQLstmt=$SQLstmt." ".$shoeDisplay." ";
  $SQLstmt=$SQLstmt." ".$checkboxDisplay." ";
  $SQLstmt=$SQLstmt." ".$checkbox2Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox3Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox4Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox5Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox6Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox7Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox8Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox9Display." ";
  $SQLstmt=$SQLstmt." ".$checkbox10Display." ";
  $SQLstmt=$SQLstmt."and modelStatus='Active' ";
  $SQLstmt=$SQLstmt."and tblImages.imageTypeID = 1 ";
  $SQLstmt=$SQLstmt."AND tblModel.modelID = tblImages.modelID ";
  $SQLstmt=$SQLstmt."ORDER BY tblModel.modelID DESC ";
  $rs=mysql_query($SQLstmt);
} 

if (mysql_num_rows($rs)==0)
{

  $countData="No results found of selected query"; ?>
				<tr>
					<td colspan="5" class="text9"><br>  <strong>Search Result</strong> </td>
				</tr>
                    <tr>
                        <td class="text" colspan="4">  <?php   echo $countData; echo $SQLstmt;echo mysql_num_rows($rs);?></td>
                    </tr>
                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>			
<?php 
}
  else
{
?><table width="100%" align="center" cellpadding="0" cellspacing="0">
                                            <tr><td class="text9"><br><strong>Search Result</strong></td><td colspan="3" align="right"></td></tr>
                                            <tr> 
                                              <td width="150" class="text"><div align="center"><strong>Thumbnail</strong></div></td>
							              <td width="150" class="text"><strong>Name</strong></td>
                                              <td width="150" class="text"><strong>Age</strong></td>
                                              <td width="150" class="text"><strong>Model 
                                                No</strong></td>
                                              <td width="75"></td>
                                </tr>
							                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>

                                            <tr> 
<?php 


while ($line = mysql_fetch_array($rs)) {
										  if ($line["modelCategory"] == "Couples") {
											$width = 100; }
											else {
											$width = 100; }
?>
                                              <td class="text"><div align="center"><a href="../models/model.php?modelID=php echo $line["modelID"]; ?>#"><img src="../cms/models/lineup/php echo $line["modelID"]; ?>/php echo $line["imageFile"]; ?>" height="100" width="php echo $width; ?>" border="0"></a></div></td>
                                              <td width="100" class="text"><?php  echo $line["modelName"]; ?></Td>
                                              <td width="100" class="text"><?php  echo $line["modelAge"]; ?></Td>
                                              <td width="147" class="text"><?php   echo $line["modelNo"]; ?></td>
                                              <td width="78" class="text"><a href="../models/model.php?modelID=<?php     echo $line["modelID"]; ?>#">View</a></td>
</tr>
                    <tr>
                      <td colspan="5" height="4"><hr /></td>
                    </tr>
     php 
}



?> 
</table></td> 
			                        
php } ?>	 

			 </tr>
				  </table></font>
				  </td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>                  
			  </tr>
                </table>
            </td>
          </tr>
                    
        </table>
      
    </div><!--// news-box //-->
    </div><!--// news-story-container //-->
    </div><!--// news-container //-->

	</div> <!-- eof content -->

</div> <!-- eof main -->

</div> <!-- eof wrap -->

<div id="footer">

</div> <!-- eof footer -->
</body>
</html>
<?php 

$rs=null;

?>

Link to comment
Share on other sites

Agreed, as you have it now, $_GET['modno']=21 would result in $modno=212121. As scootstah suggested a single line should be used.

$modno = ((isset($_GET['modno']) && is_numeric($_GET['modno'])) ? trim($_GET['modno']) : 0);

 

As far as your query, besides being a waste, using * is a bad idea especially if there are duplicate field names, in which case the query will probably fail.

But say you don't have duplicate fields, I would think a LEFT JOIN would be a better option.  In either case listing needed field names for each table would be better.

 

Link to comment
Share on other sites

it's running abit smoother however it is still processing both searches i get

 

 

Search Result:

 

model name model id

 

Search Result:

 

Name

Age

Modelid

 

 

 

why is it  processing both code? they use different queries and connections im abit stumped.

 

Link to comment
Share on other sites

the problem is i just realized there duplicate entries either in the database or it's looping multiple times.

 

 

so i get

 

picture model name model id

 

then it displays again but no picture this time just a blank field |name |model id

 

 

Link to comment
Share on other sites

awesome that took care of the duplicates now if i can only figure out why it is returning both searches.

 

search result : search 1 info here

 

search result : search 2 info here

 

 

 

i need them to be seperate searches on the same page i just can't make them run NOT at the same time. they just process together.

Link to comment
Share on other sites

There are many problems in your inline php and html.  IF no results are found you start with a <tr>.  This is fine assuming a <table> tag is above this.  However if there are results you start with a <table> tag, which I assume will result in having double <table><table> tags.  You are also not consistent in the number of columns for each row.  Much of the inline php is not right,i.e missing <? from <?php and using full quote for fields.  In the result loop you need to include the opening <tr> tag so as this loops a new line is created.  I've attempted to fix SOME table issues, commenting out the second table and making a join query though I'm only guessing the fields are what you need and it's formatted correctly for you.  I also wrapped this whole section in an IF statement so it is contained by the $_GET['modno'].  .I would suggest setting up a test page before replacing your code.

 

if (isset($_GET['modno'])){
$modno = ((isset($_GET['modno']) && is_numeric($_GET['modno'])) ? trim($_GET['modno']) : 0);

$SQLstmt = "SELECT m.modelName, m.modelID, m.modelNo, i.imageFile";
$SQLstmt .= " FROM tblModel as m";
$SQLstmt .= " LEFT JOIN tblImages as i";  
$SQLstmt .= " ON m.modelID = i.modelID";
$SQLstmt .= " WHERE m.modelNo = $modno";
$db=mysql_query($SQLstmt,$oConn) or die(mysql_error());	

if (mysql_num_rows($db)==0){

  $countData="No results found of selected query"; ?> 

	<tr>
		<td colspan="5" class="text9"><br>  <strong>Search Result</strong> </td>
	</tr>
	<tr>
		<td class="text" colspan="5">  <?php echo $countData; echo $db; echo mysql_num_rows($db); ?></td>
	</tr>
	<tr>
		<td colspan="5" height="4"><hr /></td>
	</tr>
<?php 
}else{
?>
<!-- <table width="100%" align="center" cellpadding="0" cellspacing="0"> -->
	<tr>
		<td class="text9"><br><strong>Search Result</strong></td>
		<td colspan="4" align="right"></td>
	</tr>
	<tr> 
		<td width="150" class="text"><div align="center"><strong>Thumbnail</strong></div></td>
		<td width="150" class="text"><strong>Model No</strong></td>
		<td width="75" colspan="3"></td>
	</tr>
	<tr>
		<td colspan="5" height="4"><hr /></td>
	</tr>
	<?php 
	while ($line = mysql_fetch_array($db)){
	?> 
		<tr> 
			<td class="text" colspan="3"><div align="center"><a href="../models/model.php?modelID=<?php echo $line['modelID']; ?>#"><img src="../cms/models/lineup/<?php echo $line['modelID']; ?>/<?php echo $line['imageFile']; ?>" height="100" width="<?php echo $width; ?>" border="0"></a></div></td>
			<td width="147" class="text"><?php echo $line['modelNo']; ?></td>
			<td width="78" class="text"><a href="../models/model.php?modelID=<?php echo $line['modelID']; ?>#">View</a></td>
		</tr>
		<tr>
			<td colspan="5" height="4"><hr /></td>
		</tr>
<?php
	} 
}
}
?>

 

Link to comment
Share on other sites

Looking at your full code, I see you have the code in question in an open table cell.

  <table width="100%" align="center" cellpadding="0" cellspacing="0">
                                      <tr>
                                                                <td width="81%" valign="top">

So in both the IF results found, and no results found, you're going to want am opening table tag.  Very hard to tell with all the nested tables but it looks like you have a closing table tag for this section.  Again not sure.

Link to comment
Share on other sites

Does table tblModel have the fields modelName, modelID, modelNo?  If not, adjust query.

Does table tblImages have the fields modelID, imageFile?  If not, adjust query.

 

Also is the field modelNo in the tblModel table an integer or varchar type field?

IF varchar, put condition variable in single quotes.

$SQLstmt .= " WHERE m.modelNo = '$modno'";  

Link to comment
Share on other sites

My bad.  Should have used AND instead of WHERE.

	$SQLstmt = "SELECT m.modelName, m.modelID, m.modelNo, i.imageFile";
$SQLstmt .= " FROM tblModel as m";
$SQLstmt .= " LEFT JOIN tblImages as i";  
$SQLstmt .= " ON m.modelID=i.modelID";
$SQLstmt .= " AND m.modelNo = $modno";
$db=mysql_query($SQLstmt,$oConn) or die(mysql_error());	

Link to comment
Share on other sites

After running some tests, I don't see how the query is failing using the table(s) and field names shown.  You have $oConn don't you?  For my test I setup $oConn like so, name and password removed.

<?php
$host = "localhost"; 

//MySQL Database user name.
$login = "";

//Password for MySQL.
$dbpass = "";

//MySQL Database name.
$dbn = "testdb1";

//Make connection to DB
$oConn=mysql_connect("$host","$login","$dbpass") OR DIE
        ("There is a problem with the system.  Please notify your system administrator." .mysql_error());

mysql_select_db($dbn,$oConn) OR DIE
        ("There is a problem with the system.  Please notify your system administrator." .mysql_error());
?>

Link to comment
Share on other sites

the other search works fine using the same syntax the only thing missing are these

 

 

  $SQLstmt=$SQLstmt." WHERE tblModel.modelStatus='Active' ";
  $SQLstmt=$SQLstmt."AND tblImages.imageTypeID = 1 ";

 

also would it make a difference if on the other search they used $line=["variable"] and on mine it is $line2=['variable']

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.