473,508 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Maximum dropdown size

I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate 2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.

I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.

Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!

I have tried increasing the resourses in my php.ini file but this also
made no difference.

Can anyone suggest an alternative or a fix?

Thanks

Jun 17 '07 #1
13 2170

Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate 2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.

I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.

Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!

I have tried increasing the resourses in my php.ini file but this also
made no difference.

Can anyone suggest an alternative or a fix?

Thanks
.................................................. ........................................
Can you paste same code ?

Jun 17 '07 #2
On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate 2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!
I have tried increasing the resourses in my php.ini file but this also
made no difference.
Can anyone suggest an alternative or a fix?
Thanks

.................................................. ..........................*..............
Can you paste same code ?- Hide quoted text -

- Show quoted text -
Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.

$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';

echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED';
echo "<option value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";

Thanks for your interest

Jun 17 '07 #3

Shutey íŕďčńŕ:
On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate 2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!
I have tried increasing the resourses in my php.ini file but this also
made no difference.
Can anyone suggest an alternative or a fix?
Thanks
.................................................. ..........................*..............
Can you paste same code ?- Hide quoted text -

- Show quoted text -

Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.

$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';

echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED';
echo "<option value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";

Thanks for your interest
.................................................. ............................
Code looks good. Do you tring to add
this in begining on your script ?
error_reporting(E_ALL);
ini_set("display_errors",1);
Tell me if it show messages.
P.P:
Sorry for my bad english.

Jun 17 '07 #4
Shutey wrote:
$res = mysql_query($qry) or die("Query failed);
You're missing a pair of double quotes here.

Apart from that, what web browser are you using?

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Artificial Intelligence is no match for Natural Stupidity
-- kobs
Jun 17 '07 #5
On 17 Jun, 10:24, Georgi Naumov <gonau...@gmail.comwrote:
Shutey íŕďčńŕ:
On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!
I have tried increasing the resourses in my php.ini file but this also
made no difference.
Can anyone suggest an alternative or a fix?
Thanks
.................................................. ..........................**..............
Can you paste same code ?- Hide quoted text -
- Show quoted text -
Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.
$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';
echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED';
echo "<option value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";
Thanks for your interest

.................................................. ..........................*.
Code looks good. Do you tring to add
this in begining on your script ?
error_reporting(E_ALL);
ini_set("display_errors",1);
Tell me if it show messages.
P.P:
Sorry for my bad english.- Hide quoted text -

- Show quoted text -
Thanks Georgi,
Added that but it has made no difference. I just get a blank screen
until it times out. I am tending to think it is a php resource or
timing issue because the code works fine when I only put 1 or 2
dropdowns in the form, the problem occurs as soon as I add a 3rd.

Thanks again.

Jun 17 '07 #6
On 17 Jun, 10:26, Iván Sánchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.orgwrote:
Shutey wrote:
$res = mysql_query($qry) or die("Query failed);

You're missing a pair of double quotes here.

Apart from that, what web browser are you using?

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Artificial Intelligence is no match for Natural Stupidity
-- kobs
Thanks Iván,
The missing quotes is a typo created when I simplified the field and
variable names before sending it. They do exist on my real code and it
works fine as long as I only want 1 or 2 instances of it in my form.

The web browser I am using is IE6 which is updated automatically. I
have also run it on Firefox and got the same problem.

Cheers
Jun 17 '07 #7
At Sun, 17 Jun 2007 01:45:43 -0700, Shutey let h(is|er) monkeys type:
On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
>Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2
on a fast XP pro PC, I have a form which requires 5 dropdowns
populated with indentical values. I extract the values using SQL and
populate 2 variables and use a for-next loop to create the dropdown.
The dropdown contains some 310 items! It works beautifully if I have
1 or 2 dropdowns but as soon as I add more it partially creates the
3rd and just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no
error messages or anything!
I have tried increasing the resourses in my php.ini file but this
also made no difference.
Can anyone suggest an alternative or a fix?
Thanks

................................................. ..........................*..............
Can you paste same code ?- Hide quoted text -

- Show quoted text -

Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.

$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';

echo '<table border="0" cellpadding="2" cellspacing="0"><tr>'; echo
"<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>"; echo "<option
value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed); while($row =
mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED'; echo "<option
value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";

Thanks for your interest
Does the behaviour change when you fetch associative arrays only?
(mysql_fetch_assoc())
Extract() will work with numerically indexed arrays only if
EXTR_PREFIX_ALL or EXTR_PREFIX_INVALID are used as extract-type. I would
not recommend stuffing the symbol table by using extract on each row. I
don't know how many fields each record has, I'd either reference the
required row elements directly or use
list ($field1, $field2, ..., $fieldN)= $row;

--
Schraalhans Keukenmeester - sc*********@the.Spamtrapexample.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') < 0"

Jun 17 '07 #8
Shutey wrote:
On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
>Shutey :
>>I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate 2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!
I have tried increasing the resourses in my php.ini file but this also
made no difference.
Can anyone suggest an alternative or a fix?
Thanks
................................................. ..........................*..............
Can you paste same code ?- Hide quoted text -

- Show quoted text -

Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.

$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';

echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED';
echo "<option value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";

Thanks for your interest
310 items in a single dropdown is a lot - and 5 dropdowns with the same
items is going to generate a lot of HTML. Not what I would call real
user-friendly, but it should still work.

You've shown the code for one of the dropdowns, which looks good. But
what about the other 4? How do you generate them, also?

You could also try the following - it will be a little more efficient
than your existing code. Not that there's anything wrong with your
existing code, but this might do something a little different:

echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
$x++; // Do you actually need $x?
if ($row['field1'] == $ref_variable1) // Just use the array value
$sel = ' SELECTED';
else
$sel = '';
echo "<option value='" . $row['field1'] . "'$sel>" . $row['field2'] .
"</option>";
}
echo "</select></td>";
echo "</tr></table>";

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 17 '07 #9
On 17 Jun, 11:57, Schraalhans Keukenmeester
<Schraalh...@the.spamtrapexample.nlwrote:
At Sun, 17 Jun 2007 01:45:43 -0700, Shutey let h(is|er) monkeys type:


On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2
on a fast XP pro PC, I have a form which requires 5 dropdowns
populated with indentical values. I extract the values using SQL and
populate 2 variables and use a for-next loop to create the dropdown.
The dropdown contains some 310 items! It works beautifully if I have
1 or 2 dropdowns but as soon as I add more it partially creates the
3rd and just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no
error messages or anything!
I have tried increasing the resourses in my php.ini file but this
also made no difference.
Can anyone suggest an alternative or a fix?
Thanks
.................................................. ..........................**..............
Can you paste same code ?- Hide quoted text -
- Show quoted text -
Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.
$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';
echo '<table border="0" cellpadding="2" cellspacing="0"><tr>'; echo
"<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>"; echo "<option
value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed); while($row =
mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED'; echo "<option
value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";
Thanks for your interest

Does the behaviour change when you fetch associative arrays only?
(mysql_fetch_assoc())
Extract() will work with numerically indexed arrays only if
EXTR_PREFIX_ALL or EXTR_PREFIX_INVALID are used as extract-type. I would
not recommend stuffing the symbol table by using extract on each row. I
don't know how many fields each record has, I'd either reference the
required row elements directly or use
list ($field1, $field2, ..., $fieldN)= $row;

--
Schraalhans Keukenmeester - schraalh...@the.Spamtrapexample.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') < 0"- Hide quoted text -

- Show quoted text -
I can't see how extracting the data as associative arrays would help
in this instance since I restrict the row fetch to the 2 specific
fields I required. If as I suspect the issue I am having might relate
to the resource use then however I extract the data will equally load
the process save perhaps from extracting then echoing one record at a
time but of course this would have speed issues.

My first attempt to achieve this saw me extract just 2 fields from 310
records into a 2 dimensional array and then looping through those
arrays. What I can not get my head round is that this worked well for
2 dropdowns before stopping which suggests the overhead during the
extraction is not the issue or I would not have got 1 dropdown. The
overhead or resource issue must therefore be related to the pushing of
this data through further identical processes onto the screen.

Thanks for your suggestion.
Jun 17 '07 #10
On 17 Jun, 12:51, Jerry Stuckle <jstuck...@attglobal.netwrote:
Shutey wrote:
On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
Shutey :
>I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate 2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!
I have tried increasing the resourses in my php.ini file but this also
made no difference.
Can anyone suggest an alternative or a fix?
Thanks
.................................................. ..........................**..............
Can you paste same code ?- Hide quoted text -
- Show quoted text -
Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.
$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';
echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED';
echo "<option value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";
Thanks for your interest

310 items in a single dropdown is a lot - and 5 dropdowns with the same
items is going to generate a lot of HTML. Not what I would call real
user-friendly, but it should still work.

You've shown the code for one of the dropdowns, which looks good. But
what about the other 4? How do you generate them, also?

You could also try the following - it will be a little more efficient
than your existing code. Not that there's anything wrong with your
existing code, but this might do something a little different:

echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
$x++; // Do you actually need $x?
if ($row['field1'] == $ref_variable1) // Just use the array value
$sel = ' SELECTED';
else
$sel = '';
echo "<option value='" . $row['field1'] . "'$sel>" . $row['field2'] .
"</option>";
}
echo "</select></td>";
echo "</tr></table>";

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
Thanks for this Jerry, I can see where you are coming from and you are
right it does look more efficient but alas resulted in the same issue,
2 and a half dropdowns before stopping.

The $x method was born out of my first attempt, the code I posted was
my second. Initially I started by SQLing the data into a 2 dimentional
array and then looping through them 5 times but curiously this stopped
at exacting the same point within the 3rd dropdown as the code you
have seen and with the changes you have suggested.

As you say the 5 * 310 item dropdowns are somewhat top heavy but I
have a changing group (currently 310 and likely to grow) from which
individuals can choose up to 5 from. I could have one dropdown and
allow multiple choice but this is on an Intranet for (shall we say)
heavy handed individuals and I only have 1/3 of a 1280 x 800 screen to
fit the form on!

Thanks for you suggestion.

Jun 17 '07 #11
Shutey wrote:
On 17 Jun, 12:51, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Shutey wrote:
>>On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate 2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!
I have tried increasing the resourses in my php.ini file but this also
made no difference.
Can anyone suggest an alternative or a fix?
Thanks
............................................... ............................**..............
Can you paste same code ?- Hide quoted text -
- Show quoted text -
Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.
$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';
echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED';
echo "<option value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";
Thanks for your interest
310 items in a single dropdown is a lot - and 5 dropdowns with the same
items is going to generate a lot of HTML. Not what I would call real
user-friendly, but it should still work.

You've shown the code for one of the dropdowns, which looks good. But
what about the other 4? How do you generate them, also?

You could also try the following - it will be a little more efficient
than your existing code. Not that there's anything wrong with your
existing code, but this might do something a little different:

echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
$x++; // Do you actually need $x?
if ($row['field1'] == $ref_variable1) // Just use the array value
$sel = ' SELECTED';
else
$sel = '';
echo "<option value='" . $row['field1'] . "'$sel>" . $row['field2'] .
"</option>";
}
echo "</select></td>";
echo "</tr></table>";

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -

Thanks for this Jerry, I can see where you are coming from and you are
right it does look more efficient but alas resulted in the same issue,
2 and a half dropdowns before stopping.

The $x method was born out of my first attempt, the code I posted was
my second. Initially I started by SQLing the data into a 2 dimentional
array and then looping through them 5 times but curiously this stopped
at exacting the same point within the 3rd dropdown as the code you
have seen and with the changes you have suggested.

As you say the 5 * 310 item dropdowns are somewhat top heavy but I
have a changing group (currently 310 and likely to grow) from which
individuals can choose up to 5 from. I could have one dropdown and
allow multiple choice but this is on an Intranet for (shall we say)
heavy handed individuals and I only have 1/3 of a 1280 x 800 screen to
fit the form on!

Thanks for you suggestion.
Well, I'm wondering if this is a server issue or a browser issue? I
don't think I've ever tried a page with that many options in dropdowns.
the fact it failed in exactly the same place leads me to believe it
might be a problem with the browser. The other option is maybe it's a
problem with the web server itself - but I wouldn't think so.

What happens if, instead of populating dropdowns, you just echo the
contents to the window. If it's a server issue I would expect it to
fail in about the same place. But if it's a browser issue I would
expect it to display the values.

IOW - just comment out the echo for the select tag and don't write the
option tags - just the two values. As far as PHP is concerned, the code
will be identical, but the browser will see something much different.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 17 '07 #12
On 17 Jun, 13:32, Jerry Stuckle <jstuck...@attglobal.netwrote:
Shutey wrote:
On 17 Jun, 12:51, Jerry Stuckle <jstuck...@attglobal.netwrote:
Shutey wrote:
On 17 Jun, 09:31, Georgi Naumov <gonau...@gmail.comwrote:
Shutey :
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2on
a fast XP pro PC, I have a form which requires 5 dropdowns populated
with indentical values. I extract the values using SQL and populate2
variables and use a for-next loop to create the dropdown. The dropdown
contains some 310 items! It works beautifully if I have 1 or 2
dropdowns but as soon as I add more it partially creates the 3rd and
just stops until it times out!
All 5 work because I have altered their positions but it always stops
part way through creating the 3rd dropdown.
I tried an alternative method by doing away with the variables and
constructing the dropdowns with a 'while' statement reading through
the results of my SQL and got exactly the same problem only 2 and a
bit dropdowns.
Stopping it running after a few seconds or several minutes makes no
difference, it seems to reach a certain point and just stop - no error
messages or anything!
I have tried increasing the resourses in my php.ini file but this also
made no difference.
Can anyone suggest an alternative or a fix?
Thanks
................................................ ............................***..............
Can you paste same code ?- Hide quoted text -
- Show quoted text -
Here's the code I am currently using, there are 4 more identical
'name=option2, 3, 4 and 5' but otherwise the same.
$qry = 'SELECT field1, field2 ';
$qry .= 'FROM database ';
$qry .= 'ORDER BY field1, field2;';
echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
extract($row);
$x+=1;
$sel = '';
if ($field1 == $ref_variable1) $sel = 'SELECTED';
echo "<option value='" . $field1 . "' $sel>" . $field2 . "</
option>";
}
echo "</select></td>";
echo "</tr></table>";
Thanks for your interest
310 items in a single dropdown is a lot - and 5 dropdowns with the same
items is going to generate a lot of HTML. Not what I would call real
user-friendly, but it should still work.
You've shown the code for one of the dropdowns, which looks good. But
what about the other 4? How do you generate them, also?
You could also try the following - it will be a little more efficient
than your existing code. Not that there's anything wrong with your
existing code, but this might do something a little different:
echo '<table border="0" cellpadding="2" cellspacing="0"><tr>';
echo "<td>Label 1:</td>";
echo "<td><select name='option1' size='1'>";
echo "<option value=''></option>";
$x = -1;
$res = mysql_query($qry) or die("Query failed);
while($row = mysql_fetch_array($res))
{
$x++; // Do you actually need $x?
if ($row['field1'] == $ref_variable1) // Just use the array value
$sel = ' SELECTED';
else
$sel = '';
echo "<option value='" . $row['field1'] . "'$sel>" . $row['field2'] .
"</option>";
}
echo "</select></td>";
echo "</tr></table>";
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -
- Show quoted text -
Thanks for this Jerry, I can see where you are coming from and you are
right it does look more efficient but alas resulted in the same issue,
2 and a half dropdowns before stopping.
The $x method was born out of my first attempt, the code I posted was
my second. Initially I started by SQLing the data into a 2 dimentional
array and then looping through them 5 times but curiously this stopped
at exacting the same point within the 3rd dropdown as the code you
have seen and with the changes you have suggested.
As you say the 5 * 310 item dropdowns are somewhat top heavy but I
have a changing group (currently 310 and likely to grow) from which
individuals can choose up to 5 from. I could have one dropdown and
allow multiple choice but this is on an Intranet for (shall we say)
heavy handed individuals and I only have 1/3 of a 1280 x 800 screen to
fit the form on!
Thanks for you suggestion.

Well, I'm wondering if this is a server issue or a browser issue? I
don't think I've ever tried a page with that many options in dropdowns.
the fact it failed in exactly the same place leads me to believe it
might be a problem with the browser. The other option is maybe it's a
problem with the web server itself - but I wouldn't think so.

What happens if, instead of populating dropdowns, you just echo the
contents to the window. If it's a server issue I would expect it to
fail in about the same place. But if it's a browser issue I would
expect it to display the values.

IOW - just comment out the echo for the select tag and don't write the
option tags - just the two values. As far as PHP is concerned, the code
will be identical, but the browser will see something much different.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
Problem solved! It was a resources issue. I had increased the
memory_limit in php.ini from the default 8M to 24M on the basis that I
was getting about 50% of the process to work therefore 3 time the
memory_limit should more than cope. When that didn't work I discarded
it as a solution especially as the dropdowns continued to stop in the
same place. More out of frustration than anything else I bumped it up
still further to 32M and it worked!

Now I need to discover a better way to resolve the massive dropdown
issue that doesn't require multiple pages or a screen refresh. Just
occasionally I do miss activeX controls (wash my mouth out!).

Thanks for your help

Jun 17 '07 #13
..oO(Shutey)
>Problem solved! It was a resources issue. I had increased the
memory_limit in php.ini from the default 8M to 24M on the basis that I
was getting about 50% of the process to work therefore 3 time the
memory_limit should more than cope. When that didn't work I discarded
it as a solution especially as the dropdowns continued to stop in the
same place. More out of frustration than anything else I bumped it up
still further to 32M and it worked!
PHP usually complains ("memory limit exhausted ...") when it runs out of
memory.

You could also use memory_get_usage() to check how much memory your
scripts eats (for example you could insert such a call before and after
the creation of one dropdown to get its size).

Micha
Jun 17 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
28526
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
4
33659
by: Gregory Hassett | last post by:
Hello, Does anyone know how to get the maximum size of a datagram for a UDP Socket created via .NET's System.Net.Sockets.Socket class? Thanks!
1
3497
by: Curtis | last post by:
Somehow I'm just missing something. I don't know how to catch when a user clicks on an item in a dropdown list for a dropdown style button on a toolbar. I create a new app. Form1. Add a...
3
17910
by: Madmartigan | last post by:
Hello I have the following task but am battling with the final output. How do I keep two different vectors in sync and how would I retrieve the index for the maximum value of one of the vectors??...
2
3576
by: Woody Ling | last post by:
I am now using db2 v8.2 64bits without DPF. I want to create a very large table which is about 1000G and the record length is suitable for 32K page size. I find in the manual that the maximum size...
5
5469
by: Me LK | last post by:
I need to add a line to choose a size into a dropdown . Since I have the dropdown nested inside a datagrid this is not working.When a page displays there are several rows of dropdowns but only the...
7
9102
parshupooja
by: parshupooja | last post by:
Hey All, I know its silly question but help me here. I have dropdown which is getting populated dynamic from Database with number like 1,2 ,3, 4, 6,12 etc. By Default I want maximum number to...
4
4560
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
11
4597
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1....
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.