Jump to content

houston I've got a problem ( hum what's new here )


scaleautostyle

Recommended Posts

hi guy's... it's going very well one more time thans to all of you for your help.

 

now a new one.

 

felow these step and you will find my problem. but what is the solution??

 

first go on my site english section here    http://scale24-25.com/search-db-foreach.php

 

if you clic on the secon drop down and select 935 and after the search button it will retreive all the 935 model found in the database. it' what I want. BUT

 

more specificly I want you select from the first drop down the porsche. after the 935 and then clic the search button.

 

nothing return. WHY??

 

I can put the code of both file here or just the code of the 2 drop down with the search file.

 

let me know what's going on.

 

thanks again

 

sebastien

Link to comment
Share on other sites

sure... here is the form file...( the one with the dropdown list )

 

<html>

<head>
<title>(Type a title for your page here)</title>
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='search-db-foreach.php?cat=' + val ;
}

</script>
</head>

<body >
<img src="http://www.scale24-25.com/images/banners/banner.jpg" alt="banner" width="997" height="213" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="poly" coords="0,100,85,102,92,55,108,50,326,51,323,7,3,3" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" />
<area shape="poly" coords="672,57,891,53,887,4,995,4,985,108,673,102" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" />
<area shape="poly" coords="326,12,330,52,98,53,90,91,670,98,668,53,889,50,886,4" href="http://www.scale-auto-style.com" alt="" />
<area shape="rect" coords="0,132,997,212" href="index.html">
</map>
<?php



/*
If register_global is off in your server then after reloading of the page to get the value of cat from query string we have to take special care.



@$cat=$_GET['cat']; // Use this line or below line if register_global is off
if(strlen($cat) > 0 and !is_numeric($cat)){ // to check if $cat is numeric data or not. 
echo "Data Error";
exit;
}

*/
@$cat=$HTTP_GET_VARS['cat']; // Use this line or above line if register_global is off


if (isset($_POST['todo']) && $_POST['todo'] == "search") {    $todo=$_POST['todo'];

$manufacturer_reel=$_POST['manufacturer_reel'];

$query="select * from kit where  ";

@$manufacturer_reel=$_GET['manufacturer_reel']; // Use this line or below line if register_global is off
if(strlen($manufacturer_reel) > 0 and !is_numeric($manufacturer_reel)){ // to check if $cat is numeric data or not. 
echo "Data Error";
exit;
}
/*
////////// Including manufacturer_reel field search ////
if(strlen($manufacturer_reel) > 0 ){
$query.= " manufacturer_reel='$manufacturer_reel' and "; 
}  
//// End of class field search /////////// */

$query=substr($query,0,(strLen($query)-4));

echo $query;
echo "<br><br>";
$nt=mysql_query($query);
echo mysql_error();

// End if form submitted



}else{

echo "<form method=post action='search-keyword.php?go'><input type=hidden name=todo value=search>";
?>
<table width="960" border="0">
  
  <tr>
    <td width="355"></td>
    <td width="250"> </td>
    <td width="355"> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td rowspan="9"><div align="center">To help me filling the database download the instruction and master file <a href="base de donnee/master_database.xls"><img src="catalog/images/design_web/master-bouton-en.jpg" alt="bout" width="272" height="54" border="0"></a></div></td>
    <td align="center"><?php


///////// Getting the data from Mysql table for first list box//////////
$q=mysql_query("SELECT DISTINCT manufacturer_reel,manufacturer_reel_id FROM kit order by manufacturer_reel"); 
///////////// End of query for first list box//////////



//////////        Starting of first drop downlist /////////
echo "<select name='cat' onchange=\"reload(this.form)\"><option value=''>Please Choose an Option</option>";
while($row = mysql_fetch_array($q)) { 
if($row['manufacturer_reel_id']==@$cat){echo "<option selected value='$row[manufacturer_reel_id]'>$row[manufacturer_reel]</option>"."<BR>";}
else{echo  "<option value='$row[manufacturer_reel_id]'>$row[manufacturer_reel]</option>";}
}
echo "</select>"; 
echo " <br> \n";
echo " <br> \n";
//  end of drop down  ///

?></td>
    <td><div align="left">Name Of vehicule manufacturer</div></td>
  </tr>
  <tr>
    <td align="center"> </td>
    <td> </td>
  </tr>
  <tr>
    <td><div align="center">
        <?php /////// for second drop down list we will check if manufacturer_reel is selected else we will display all the car_model///// 
if(isset($cat) and strlen($cat) > 0){
$q=mysql_query("SELECT DISTINCT car_model FROM kit where manufacturer_reel_id=$cat order by car_model"); 
}else{$q=mysql_query("SELECT DISTINCT car_model FROM kit order by car_model"); } 

////////// end of query for second car_model drop down list box ///////////////////////////


//////////        Starting of second drop downlist //////////


echo '<select name="car_model"><option value="car_model">Please Choose an Option</option>';
while($row = mysql_fetch_array($q)) {
$thing = $row['car_model'];
echo '<option>'.$thing.'</option>';
}
echo "</select>";
echo " <br> \n";
echo " <br> \n";
////////    end of second drop down //////////
?>
      </div>
    <td> vehicule manufacturer model</td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td align="center"><?php 
//  strat of drop down  ///
$q=mysql_query("SELECT DISTINCT scale FROM kit ORDER BY scale");
echo '<select name="scale"><option value="scale">Please Choose an Option</option>';
while($row = mysql_fetch_array($q)) {
$thing = $row['scale'];
echo '<option>'.$thing.'</option>';
}
echo "</select>";

echo " <br> \n";
echo " <br> \n";

?></td>
    <td><div align="left">Scale of model</div></td>
  </tr>
  <tr>
    <td> </td>
    <td><div align="right"></div></td>
  </tr>
  <tr>
    <td align="center"><?php
//  start of drop down  ///
$q=mysql_query("SELECT DISTINCT manufacturer_kit FROM kit ORDER BY manufacturer_kit");
echo '<select name="manufacturer_kit"><option value="kit manufacturer">Please Choose an Option</option>';
while($row = mysql_fetch_array($q)) {
$thing = $row['manufacturer_kit'];
echo '<option>'.$thing.'</option>';
}
echo "</select>";

//  end of drop down  ///
echo " <br> \n";
echo " <br> \n";

?></td>
    <td><div align="left">Name Of kit manufacturer</div></td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td align="center"><?php
//  strat of drop down  ///
$q=mysql_query("SELECT DISTINCT year_prod_reel FROM kit ORDER BY year_prod_reel");
echo '<select name="year_prod_reel"><option value="vehicules year manufactured">Please Choose an Option</option>';
while($row = mysql_fetch_array($q)) {
$thing = $row['year_prod_reel'];
echo '<option>'.$thing.'</option>';
}
echo "</select>";
//  end of drop down  ///
echo " <br> \n";
echo " <br> \n";

?></td>
    <td><div align="left">
      <p>Year of production of the vehicule</p>
      <p> </p>
    </div></td>
  </tr>
  <tr>
    <td> </td>
    <td align="center"> </td>
    <td> </td>
  </tr>
  </table>
  
<table width="960" border="0">
            <tr>
              <td><div align="center">
                <?php

echo "
<br><input type=submit value=Search name='name' action='search-keyword.php?go' >
</form>
";
}


?>
              </div></td>
            </tr>
          </table>          
   
      
      <table width="980" border="1">
  <tr>
    <td colspan="3" bgcolor="#EDEDED"><div align="center"><a href="http://www.modelencyclopedia.com/"><img src="catalog/images/banners/davidcuraencyclopedy.gif" alt="banner1" border="0" /></a></div></td>
  </tr>
  <tr>
    <td bgcolor="#EDEDED" width="480"><p align="center">Without his help this site will stay under development</p>    </td>
    <td> </td>
    <td bgcolor="#EDEDED" width="480"><p align="center">Sans son aide se site serais toujours en dévelopement</p>    </td>
  </tr>
</table>






</body>

</html>


    

 

 

and this is the result file...

 

<html>

<head>
<title>(Type a title for your page here)</title>

</head>

<body >
<p align="center"><img src="http://www.scale24-25.com/images/banners/banner.jpg" alt="banner" width="997" height="213" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="poly" coords="0,100,85,102,92,55,108,50,326,51,323,7,3,3" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" />
<area shape="poly" coords="672,57,891,53,887,4,995,4,985,108,673,102" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" />
<area shape="poly" coords="326,12,330,52,98,53,90,91,670,98,668,53,889,50,886,4" href="http://www.scale-auto-style.com" alt="" />
<area shape="rect" coords="-1,128,996,208" href="../index.html">
</map></p>
<table width="920" border="0">
  <tr>
    <td width="359"><p class="style5">You will find some TBC. TBC is for "To Be Confirmed". If somebody know the missing information ( TBC ) it will be appreciate to send it to me at this mail: <a href="mailto:info@hobby-shop.qc.ca">info@hobby-shop.qc.ca</a> <br />
        <br />
thanks in advance for your help</p>
    </td>
    <td width="161"><div align="center"><a href="search-db-foreach.php"><img src="catalog/images/design_web/othersearch.jpg"  border="0" alt="search" width="150" height="96"></a></div></td>
    <td width="386"> <div align="right">
      <p>This logo <img  src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50'/> mean that you can download a PDF file. To read it you need minimum Acrobat reader and you can download it <a href="http://get.adobe.com/reader/">here</a></p>
      <p>Some link will return a TBC. Sorry for any inconveniant. as soon as we will receive or do the PDF it will be updated.</p>
    </div></td>
  </tr>
</table>


<br>







<?php
if (isset($_POST['todo']) && $_POST['todo'] == "search") {    $todo=$_POST['todo'];

$name=$_POST['cat'];
$name1=$_POST['manufacturer_kit'];
$name2=$_POST['year_prod_reel'];
$name3=$_POST['scale'];
$name11=$_POST['car_model'];


//-query  the database table for the post field  

$sql="SELECT  kit_id, kit_number, kit_name, description_eng, manufacturer_kit, manufacturer_reel, scale, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2  FROM kit ";
    $sqlOperand="WHERE";
    if ($name != "cat") {
        $sql = $sql . $sqlOperand . " manufacturer_reel LIKE '%" . $name ."%' ";
        $sqlOperand = " AND ";
    }
    if ($name1 != "kit manufacturer") {
        $sql = $sql . $sqlOperand . " manufacturer_kit LIKE '%" . $name1 ."%' ";
        $sqlOperand = " AND ";
    }
    if ($name2 != "vehicules year manufactured") {
        $sql = $sql . $sqlOperand . " year_prod_reel LIKE '%" . $name2 ."%' ";
        $sqlOperand = " AND ";
    }
    if ($name3 != "scale") {
        $sql = $sql . $sqlOperand . " scale LIKE '%" . $name3 ."%' ";
        $sqlOperand = " AND ";
    }
if ($name11 != "car_model") {
        $sql = $sql . $sqlOperand . " car_model LIKE '%" . $name11 ."%' ";
        $sqlOperand = " AND ";
    }
    if ($sqlOperand == "WHERE") {
           echo  "<p>Please enter a search query</p>";   
    } 

else {
   //   echo '<img src="web-design/sorry.jpg" alt="sorry">';
       	
       // echo "Sorry nothing match your selection / Desolle rien ne correspond a votre selection";
   // echo "run sql: <BR> $sql <BR> and display results";
    }



  //-run  the query against the mysql query function   
   $result=mysql_query($sql);  
   
  //-make the header of the table   
   
   echo "  <table align=center width=\"1340\" border=\"\">\n";
   echo "    <tr>\n";
   echo"  <td nowrap align=center width='95'>  kit manufacturer  \n";		
   echo"  <td nowrap align=center width='55'>	scale \n";		
   echo"  <td nowrap align=center width='90'>	kit number \n";		
   echo"  <td nowrap align=center width='290'>	kit name \n";		
   echo"  <td nowrap align=center width='400'>	description_eng \n";
   echo"  <td nowrap align=center width='125'>	vehicule year \n";		
   echo"  <td nowrap align=center width='80'>	complete engine detail\n";		
   echo"  <td nowrap align=center width='80'>	Select Picture to get bigger\n";
   echo"  <td nowrap align=center width='75'>	instruction sheet\n";
   echo"  <td nowrap align=center width='75'>	box contain\n";
   echo "    <tr>\n";

   //-create  while loop and loop through result set   
   while($row=mysql_fetch_array($result)){   
         $description_eng=$row['description_eng'];   
         $manufacturer_kit=$row['manufacturer_kit']; 
	 $scale=$row['scale'];
	 $car_model=$row['car_model'];
	 $cat=$row['cat'];
	 $manufacturer_reel=$row['manufacturer_reel'];   
         $kit_id=$row['kit_id']; 
	 $kit_number=$row['kit_number'];
	 $kit_name=$row['kit_name'];
	 $engine_detail=$row['engine_detail'];
	 $year_prod_reel=$row['year_prod_reel'];
	 $image_id=$row['image_id'];
	 $image_id1=$row['image_id1'];
	 $image_id2=$row['image_id2'];


	   
   //-create  table of item during he while loop
   
echo "  <table align=center width=\"1340\" border=\"\">\n";		   
echo"  <td nowrap align=center width='95'>  $manufacturer_kit  \n";	
echo"  <td nowrap align=center width='55'>  $scale  \n";
echo"  <td nowrap align=center width='90'>	$kit_number \n";		
echo"  <td nowrap align=center width='290'>	$kit_name \n";		
echo"  <td nowrap width='400'>	$description_eng \n";
echo"  <td nowrap align=center width='125'>	$year_prod_reel \n";		
echo"  <td nowrap align=center width='80'>	$engine_detail \n";	
if(!empty($image_id))    echo"  <td nowrap width='80'> <a href= ".$image_id."> <img src= '".$image_id."' width='75' height='50' border='0'/>";else    echo "  <td nowrap width='75'>    <img src='http://www.scale24-25.com/images/tbc.jpg' width='50' height='50' border='0'/>";
if(!empty($image_id1))    echo"  <td nowrap width='75'> <a href= ".$image_id1."> <img src='http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";else    echo "  <td nowrap width='75'>    <img src='http://www.scale24-25.com/images/tbc.jpg' width='50' height='50' border='0'/>";
if(!empty($image_id2))    echo"  <td nowrap width='75'> <a href= ".$image_id2."> <img src='http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";else    echo "  <td nowrap width='75'>    <img src='http://www.scale24-25.com/images/tbc.jpg' width='50' height='50' border='0'/>";
echo "    </tr>\n";
echo "    </table>\n"; 
echo "    </tr>\n";
echo "    </table>\n";


   }   
   }  
   else{   
   echo  "<p>Please enter a search query</p>";   
   }   
   
?>  


  



</body>

</html>

 

I hope this will help to debug ...

 

yours

 

sebastien

 

 

Link to comment
Share on other sites

Yeah, I couldn't get any of the manufacturers I tried to actually pull anything by themselves.

 

Make sure the values associated to the drop down match up with the values you're looking for in the database. After looking at your source it looks like they're going numerically, is does the database show the manufacturer_reel field as having numerical values?

 

If so, try this query on the machine alone -

 

select * from kit where manufacturer_reel = '1';

 

That should bring up the Porsche if I'm not mistaken.

 

You might want to clean up some of the HTML in there too, on the result file.

Link to comment
Share on other sites

Your not setting any values for the last four drop down menus. You're only setting the Label. The Label is never treated as the value.

 

the things is everything work fine on the four last drop down.

 

EX: if you choose kit manufacturer = tamiya , scale = 1/24 and the year 2004 it will bring you 2 result.

if you choose only the year 2000 alone it will bring you 3 result. so these filed work correctly.

 

so let me see something....

 

 

S

Link to comment
Share on other sites

Yeah, I couldn't get any of the manufacturers I tried to actually pull anything by themselves.

 

Make sure the values associated to the drop down match up with the values you're looking for in the database. After looking at your source it looks like they're going numerically, is does the database show the manufacturer_reel field as having numerical values?

 

If so, try this query on the machine alone -

 

select * from kit where manufacturer_reel = '1';

 

That should bring up the Porsche if I'm not mistaken.

 

You might want to clean up some of the HTML in there too, on the result file.

 

it should be OK because on the french side it work fine. the difference between the french side and the english one is ... I don't put the model drop down at this moment. so if you select porsche it will bring you all porsche.

 

clic the scale24-25.com banner to be able to go on the french one.

 

yours

 

sebastien

Link to comment
Share on other sites

Actually, the french side didn't work for me at all. Looks like it tries to open up an xls document but can't find it altogether. Looking at your source, your options don't even have values on the French side...There's no way it's working (or at least the way you'd want it to). Unless you want it to redirect to something invalid, then it's working fine.  :D

Link to comment
Share on other sites

Actually, the french side didn't work for me at all. Looks like it tries to open up an xls document but can't find it altogether. Looking at your source, your options don't even have values on the French side...There's no way it's working (or at least the way you'd want it to). Unless you want it to redirect to something invalid, then it's working fine.  :D

 

clic the small button at the bottom to search.

 

thanks

 

sebastien

Link to comment
Share on other sites

Doh! Epic fail on my part. Didn't see it on my browser at the bottom. I clicked on the big blue shiny button that said 'télécharger", which after revisting the English side, I assume translates to download. I like the blue button better.  :P

 

But my point still remains valid. You're missing the values under options on the french side, on the English side you have them numerical. Do you have a different database for each? If it's the same database then that will more than likely be your problem...

Link to comment
Share on other sites

English Side:

<select name='manufacturer_reel' onchange="reload(this.form)"><option value=''>Please Choose an Option</option><option value='0'></option><option value='0'> MclAREN </option><option value='23'>alfa romeo</option><option value='14'>audi</option><option value='2'>bmw</option><option value='0'>CHEVY</option><option value='26'>citroen</option><option value='31'>daihatsu</option><option value='9'>datsun</option><option value='19'>ferrari</option><option value='27'>fiat</option><option value='10'>ford</option><option value='12'>honda</option><option value='29'>isuzu</option><option value='20'>jaguar</option><option value='22'>jeep</option><option value='4'>Lamborghini</option><option value='3'>lancia</option><option value='16'>lotus</option><option value='7'>mazda</option><option value='13'>mercedes</option><option value='15'>mini</option><option value='21'>mitsubishi</option><option value='28'>morgan</option><option value='11'>nissan</option><option value='24'>opel</option><option value='17'>peugeot</option><option value='1'>porsche</option><option value='8'>renault</option><option value='18'>subaru</option><option value='5'>toyota</option><option value='6'>volkswagen</option><option value='25'>volvo</option><option value='30'>yamaha</option></select>

 

French Side:

<select name="manufacturer_reel"><option value="reel manufacturer">Please Choose an Option</option><option></option><option> MclAREN </option><option>alfa romeo</option><option>audi</option><option>bmw</option><option>CHEVY</option><option>citroen</option><option>daihatsu</option><option>datsun</option><option>ferrari</option><option>fiat</option><option>ford</option><option>honda</option><option>isuzu</option><option>jaguar</option><option>jeep</option><option>Lamborghini</option><option>lancia</option><option>lotus</option><option>mazda</option><option>mercedes</option><option>mini</option><option>mitsubishi</option><option>morgan</option><option>nissan</option><option>opel</option><option>peugeot</option><option>porsche</option><option>renault</option><option>subaru</option><option>toyota</option><option>volkswagen</option><option>volvo</option><option>yamaha</option></select

 

The French side is lacking the numerical values in the options. Which is why I wanted you to run that query against the machine itself.

Link to comment
Share on other sites

hi m4vrick...  when I start this search page it was like the french side and everything was working nice.

 

the thing I want to update was. when you select the car manufacturer a second dropdown ( car model ) will populate automaticly from the database. but to do that I don't have the choice to put a numeric value to each manufacturer.

 

if you know an other way to do that let me know may be it will slve the problem.

 

yours

 

sebastien

Link to comment
Share on other sites

Well to my knowledge the difference between the two is that if the value isn't specified, then it defaults to what is between the 'option' tags. So on the French side you're actually sending the car manufacturer, but on the English side you're sending numbers. You should be able to just rewrite the part of it that is parsing for numbers to instead compare string values for the manufacturers you're looking for.

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.