How to display the php query value to the drop-down box-php Tutorial

Source: Internet
Author: User
How can I display the php query value in the drop-down box? I want to display the queried value in the drop-down box.
This value can only be upper, middle, and lower.
Add me

But in this case, there will be two identical values.
I don't know how to write if I only show one

$ SQL = "select * from 'XX '";
$ Query = mysql_query ($ SQL );
$ Rs = mysql_fetch_array ($ query );
?>
Upper Medium Lower


Reply to discussion (solution)

 
  
   
   

I don't know what it means,

Isn't there only one option here? how can there be two identical values.

$ Rs = mysql_fetch_array ($ query );
This function is incorrect. it has ASSOC, NUM, and BOTH returned methods. your return method is BOTH, that is, one key name and one subscript each, so there will be two.
Let's take a look at the differences between mysql_fetch_arry and mysql_fetch_row.

I don't know what it means,

Isn't there only one option here? how can there be two identical values.
There are three data records, which are read from the upper, lower, and lower layers. $ rs ['type'], $ rs [0], and each has one data record. Therefore, six data records are read.

 
  
   
   

This code should be the same as his own results. Replace mysql_fetch_assoc ($ query) with your desired result.


I don't know what it means,

Isn't there only one option here? how can there be two identical values.
There are three data records, which are read from the upper, lower, and lower layers. $ rs ['type'], $ rs [0], and each has one data record. Therefore, six data records are read.
Take a closer look at his code. do you have $ rs [0?

I understood it wrong.



I don't know what it means,

Isn't there only one option here? how can there be two identical values.
There are three data records, which are read from the upper, lower, and lower layers. $ rs ['type'], $ rs [0], and each has one data record. Therefore, six data records are read.
Take a closer look at his code. do you have $ rs [0?

In this case, if the value returned by my code is
The drop-down box is displayed.
Upper
Upper
Medium
Lower
If the returned value is
Yes
Lower
Upper
Medium
Lower
There will be duplicates

I don't know what your intention is. I don't know what you want.


Because I wrote a form. this item is fixed with three values: top, bottom, and bottom.
Select one of the single INSERT drop-down tables
Form 2 select the value of this item first and then select another UPDATE from the drop-down list.

Poor language organization capability...

It's easy. use the condition to determine whether $ rs ['type'] is equal to one of the upper and lower layers. useThe selected attribute control is displayed.

> Above> Medium> Bottom

$ Rs = mysql_fetch_array ($ query );
Print it out and see what it is.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.