I'm trying to populate the pulldown menus of a single input form
through queries from a single table. The three columns are 'name',
'type', and 'status'. The name table runs to approx row 23, the type,
to row 8, and status, row 9. . I'm using the following code to
populate the form pulldown menus::
<?php
$query = "SELECT DISTINCT status
FROM $table";
$result = mysql_query($qu ery);
$number = mysql_numrows($ result);
for ($i=0; $i<$number; $i++) {
$status = mysql_result($r esult,$i,"statu s");
print "<option value=\"$status \">$status</option>";
}
mysql_close();
?>
The interesting portion here is that 'name' only allows a single blank
space on the pulldown as I had expected and so does 'status'. 'Type'
on the other hand, shows 2 blank spaces on the pulldown menu so what's
with that? Is there some sort of 'end of file marker' that I should
be inserting to the database columns to get this to read correctly?
TIA 5 1721
On 26.07.2007 09:51 Toby A Inkster wrote:
cover wrote:
>$query = "SELECT DISTINCT status FROM $table";
Most databases optimise GROUP BY better than DISTINCT. Generally speaking,
if you can avoid DISTINCT, you should: it forces the database engine to
retrieve rows and then discard them, whereas often, especially with
well-indexed columns, the engine will be able to do smarter things with
GROUP BY.
Don't know about "most" ones, mysql docs explicitly says they're equivalent http://dev.mysql.com/doc/refman/5.0/...imization.html
--
gosha bine
makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
On 27 Jul, 11:31, gosha bine <stereof...@gma il.comwrote:
On 27.07.2007 11:46 Toby A Inkster wrote:
gosha bine wrote:
Don't know about "most" ones, mysql docs explicitly says they're equivalent http://dev.mysql.com/doc/refman/5.0/...imization.html
It says that SELECT DISTINCT and GROUP BY *usually* end up generating the
same execution plan, so there won't be a performance difference.
Pretending that you cannot read is probably the worst defense you could
come up with. ;)
--
gosha bine
makrell ~http://www.tagarga.com/blok/makrell
php done right ;)http://code.google.com/p/pihipi
But it is you who cannot read!
The manual does NOT (neither explicitly not implicitly) say that GROUP
BY and DISTINCT are equivalent.
What it does say is:
"In most cases, a DISTINCT clause can be considered as a special case
of GROUP BY."
And it then says:
"For example, the following two queries are equivalent: ..."
The phrase "In most cases" implies that they are not equivalent. If
they were it would say "In all cases".
On Thu, 26 Jul 2007 08:51:22 +0100, Toby A Inkster
<us**********@t obyinkster.co.u kwrote:
<snip>
Hey, looks like some great ideas and I'll give them a try. Thank you
very much. :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phillip Russell |
last post by:
Is there a way for PHP to see what is selected in a pull-down menu. So
that i can use a switch statement to display certain information. If
not how can I combine javascript with it to work.
|
by: Glenn Mulno |
last post by:
Hi,
I am trying to create a report page for several teams. Each team runs the
same reports but the reports use different values.
For a while this was getting insane everytime I updated the queries I had to
change them in many places. Then I started using server side includes to
keep me from changing some items in multiple places.
There is still some double (quadruple) updating going on though when I make
|
by: jt |
last post by:
I am new to Javascript and I am having problems with loading a pull
down menu.
I get this error:
javax.servlet.ServletException: No data found
It will list the items just fine if I just list the items without
using the select & option tags. I would like to know why I am getting
an error with the following statement:
|
by: NEUE |
last post by:
Hello,
I'm trying to have a layer appear on top of a simple pull-down menu,
but in IE6 the pull-down menu always appears on top. Even if I put the
pull-down in a layer under the other layers, it shows on top. On
Firefox and all Mac browsers is fine. Any way around this?
Thanks
NF
|
by: judiphuongtu |
last post by:
I am trying to create an input form with a pull-down menu that allows a
user to add an item to the pull-down. I don't want the page to refresh
when I refresh the pull-down since there's entries on the form already.
Please help!
Thanks.
jptu
| |
by: Keith Burns |
last post by:
Hi,
I have seen two entries in the archives for this topic:
1. Uses hypertext, not a pulldown menu to feed parameters back to the python
CGI
2. The other actually used Java.
Is there a way using Python for CGI such that when a user selects an item
from one pull down menu (ie FRUIT or VEGETABLE or MEAT) that another pull
|
by: dkimbrell |
last post by:
Hi there,
I'm very novice to web design. I'm trying to make a pulldown menu, but
the formatting keeps getting screwed up when you roll the mouse over
it.
Please see www.boundarysys.com for what I'm talking about. Before the
mouse touches the pulldown, the vertical height of the menubar is
perfect. As soon as the mouse rolls over it, it expands to about twice
the height.
|
by: giandeo |
last post by:
Hello Experts.
Is it possible to retrieve the value from a populated pull down menu from a database and then use that value to access the same database to get the related fields.
Example:
Database name: sp
Table: importer
Field names: imp_code, imp_name, imp_address, imp_tel
|
by: giandeo |
last post by:
Hello Experts.
Could you find a solution for this problem please!
I have the following tables in Access Database
Table Name: origin
Fields Names: country, countrycode
Table Name: make
Fields Names: countrycode, make
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |