Forum Moderators: coopster

Message Too Old, No Replies

PHP :: generating a dynamic list

PHP, mySQl, select statement

         

bigsoundz

6:15 pm on Jun 8, 2005 (gmt 0)



I am tying to write a statement that will compare the values of 2 columns, and display the result in a temp table.

ex. Table A has the following columns: "Minimum" and "Maximum." The temp table will hold the reult of the difference between the 2 columns of table A.

Scope: I am trying to crate a drop down with the resulting data as it is incremented. If Min = 2 and Max = 7, the TEMP tab;e should get the results of 2,3,4,5,6,7. I want to have this result displayed in a drop-down list.

Any ideas?

JamShady

7:01 pm on Jun 8, 2005 (gmt 0)

10+ Year Member



You can use range() in PHP to generate the array ;)

coopster

9:25 pm on Jun 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, bigsoundz.

So, you would

SELECT min, max FROM mytable;

...retrieve the row(s), then use the PHP range() [php.net] function to generate an array which you could use for your select list.