Page 1 of 1

2 Dynamic Dropdowns : second is only filled a bit

Posted: Thu Feb 17, 2005 2:55 pm
by asterinex
Hello Folks,
Hope someone can help me out. I have a table with +-4000 Postal codes en their cities. Now I have 2 dropdowns where people can searh between.
for exemple : give me all records between postal 1000 and 2000.
The problem is that the second dropddown has only a few postals with the same code. A memory Problem.

Code: Select all

$sql  = "SELECT * FROM postal_bel ORDER BY postal asc;";  
	    
$result1 = mysql_query($sql,$conn);
$numrows = mysql_num_rows($result1);
for ($i=0;$i<$numrows;$i++)
&#123;	
    $myrow = mysql_fetch_array($result1);
    $value_array&#1111;$i] = "<option value=".$myrow&#1111;'postal'].">".$myrow  &#1111;'postal']." ".$myrow&#1111;'city']."</option>";
 
 &#125;
mysql_free_result($result1);
?>

<select name="searchpostal1">
<?php 
 for ($i=0;$i<sizeof($value_array);$i++)
    echo $value_array&#1111;$i];
?>
</select>
//Dropdown 2 : Problem is only Filled a bit ?
<select name="2">
<?php 
 for ($i=0;$i<sizeof($value_array);$i++)
	echo $value_array&#1111;$i];
?>
</select>
Does anyone can help me ?

Thx in advance!

Posted: Thu Feb 17, 2005 3:25 pm
by feyd
do you have output buffering on? You may be able to save some memory by storing the options as a single string, instead of an array.