GetDotted Domains

Viewing Thread:
"Is this possible with PHP?"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Wed 16/02/05 at 20:24
Regular
"Picking a winner!"
Posts: 8,502
I have a table in my database which contains a users ID and a number.
What I want to be able to do is for each user when they view a particular page to have a pull down menu which contains the numbers from the table in the databse that apply to them. Some users will have no numbers and some users may have quite a few 10+

eg

userID | number
1......| 345
2......| 345
1......| 121
1......| 567

So when user 1 views the page they get the menu with 345, 121 and 567 in it but if user 2 views it they only get 345.

At the moment they have to enter a number from memory and I think it would be much better if they could select it from a menu, other alternative is just to display the numbers that apply to them but I feel that the pull down menu would be a better solution.

So can it be done? If so how easy would it be?

Cheers
Wed 16/02/05 at 20:24
Regular
"Picking a winner!"
Posts: 8,502
I have a table in my database which contains a users ID and a number.
What I want to be able to do is for each user when they view a particular page to have a pull down menu which contains the numbers from the table in the databse that apply to them. Some users will have no numbers and some users may have quite a few 10+

eg

userID | number
1......| 345
2......| 345
1......| 121
1......| 567

So when user 1 views the page they get the menu with 345, 121 and 567 in it but if user 2 views it they only get 345.

At the moment they have to enter a number from memory and I think it would be much better if they could select it from a menu, other alternative is just to display the numbers that apply to them but I feel that the pull down menu would be a better solution.

So can it be done? If so how easy would it be?

Cheers
Wed 16/02/05 at 22:20
Regular
"It goes so quickly"
Posts: 4,083
Easy as pie, though I'm tired and about to go to bed, so I'll give you the jist, and hopefully you can do the rest.

1. Run the query SELECT number FROM table WHERE id=1; or somthing like that (haven't done SQL for a little while, so my syntax may be wrong.)

2. Output an HTML select list and form:







Sorry if I completely mess up the syntax, but like I said ... zzzzZZZZ
Wed 16/02/05 at 22:53
Regular
"Picking a winner!"
Posts: 8,502
Thanks for the reply.

I was trying something very similar. But I was using a printf in the while loop so the menu was being displayed but with no entries in it.
Tried using the echo instead just there and its displaying stuff in the menu, not what I wanted though as its displaying the variable name and not what it has been assigned too. Sure its more likely something to do with my code so I'll look over it again.

Edit: Still just displaying $number instead of the actual value from the table, what I've tried hasn't worked. Going to get some sleep and give it another go tomorrow.

thanks again
Thu 17/02/05 at 00:03
Regular
"NULL"
Posts: 1,384
Try:
----------------------





Thu 17/02/05 at 11:40
Regular
Posts: 138
Excellent, thanks.

After a few little changes to the code that seemed to produce the right results.
Nice one

Much appreciated.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.
I've been with Freeola for 14 years...
I've been with Freeola for 14 years now, and in that time you have proven time and time again to be a top-ranking internet service provider and unbeatable hosting service. Thank you.
Anthony

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.