|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
mikeken Smarty Regular
Joined: 13 Aug 2003 Posts: 57 Location: MN
|
Posted: Wed Aug 20, 2003 12:18 am Post subject: html_options and mysql select |
|
|
OK, hopefully my other thread will get deleted since I asked for it to be.
Now, i have a table called styles In side are 3 columns 2 of which are important. One is id which is autoincremented. The other is name.
Here are a few of the rows.
id name
--------------------
1 Trance
2 House
3 Techno
I would like to get all of those values into a dropdown menu.
How can I do this. I tried every single way I can think of.
It never gave the right output, although a couple of the tries I did,
theoretically should have worked.
I know boards are usually not for writing code for, but for helping a person write his code, but I am totally slumped. Could someone give me any example on how to do this?
I would really appreciate this, especially since I have a deadline for my website to be finished: Friday, August 29th. (No pressure on you guys though)
--Mike
Last edited by mikeken on Wed Aug 20, 2003 2:57 am; edited 2 times in total |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Aug 20, 2003 2:49 am Post subject: |
|
|
Hi takenoacid,
Messju made a pretty good reply to this issue in this thread.
The important thing is to take a closer look at the array types that are expected by html_options (docs). Unlike the mysql result set (which is an indexed array of rows each containing an array of field results), the pattern required for html_options is either an array for each of ids and names or an associative array of id=>name.
As Messju shows, you need to create a reformed array of your result set in PHP prior to assigning it to Smarty.
HTH |
|
Back to top |
|
mikeken Smarty Regular
Joined: 13 Aug 2003 Posts: 57 Location: MN
|
Posted: Thu Aug 21, 2003 1:19 am Post subject: |
|
|
Wouzer, well I didnt understand anything from anybody. But I decided to go to bed earlier last night, say 10:00pm.
I did and I got up today and I though of a workaround for my problem.
Its amazing what sleep can do for you. Im gonna have to try this out more often when I am stuck. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|