Hello All,
I'm familiar and comfortable with selecting and utilizing one record at a
time in my php-mysql gui / application. But now I'm faced with having to
select one field from 24 records and assign the results to 24 different
variables.
Table structure:
CONFIG
+----------------------+----------------------+
| Field | Type |
+----------------------+----------------------+
| meter_num | int(11) | primary key
| x | double |
| y | double |
| z | double |
| cc_val | varchar(64) |
| cc_date | date | primary key
| esn | varchar(64) |
| dsn | varchar(64) |
| csn | varchar(64) |
| comm_setup | varchar(128) |
| multi_port | varchar(16) |
| threshold | double |
| short_label | varchar(20) |
| label | varchar(80) |
| comments | varchar(255) |
| mod_date | datetime |
+-------------+--------------+------+-------+
query ="SELECT short_label FROM config ORDER BY meter_num";
There will be 24 records max in this table, and meter_num is a primary key
with values 1- 24 .
If I run this query in the MySQL client, I get a result set like this:
short_label_1
short_label_2
//
//
short_label_24
And I'd like to be able to do this:
$sLabel_1 = short_label_1;
$sLabel_2 = short_label_2;
etc...
These variables / values then get displayed in an HTML table in the
appropriate place. I know that I can add a where clause to the query to
select / assign each label individually, but that's 24 queries just for
this one piece of data. Seems to me there must be a more efficient way to
do this, but I'm runnin' out of ideas.
Hope someone is thinking more clearly than I am right now.
Thanks.
David