![]() |
PHP, MySQL, and Dropdown lists
I have a question. Is it possible to get all the fields from a table inside a MySQL database, and display 'em, one by one, inside a dropdown list? I'm pretty sure it is, but I don't want to do 3+ hr.'s of coding to find out it won't work.
|
Re: PHP, MySQL, and Dropdown lists
Quote:
|
Re: PHP, MySQL, and Dropdown lists
Quote:
I'll try that and see what happens. |
Re: PHP, MySQL, and Dropdown lists
Quote:
PHP Code:
|
Re: PHP, MySQL, and Dropdown lists
Thank you :)
What I mean here though (I dunno if you stated this, I'm really tired today so...), is something like this: Inside a table (named "Bob"), there's 4 fields ("Hi", "I", "Love", "ChiefDelphi"). what I want to do is search through Bob, and for each field, I want to put each into a dropdown list. So, the choices would be like: "Hi", then next one is "I", then "Love", finally "ChiefDelphi". |
Re: PHP, MySQL, and Dropdown lists
Quote:
|
Re: PHP, MySQL, and Dropdown lists
After trying your code, I realized it's not exactly what I'm looking for. I'm trying to directly output the fields, not the field values.
|
Re: PHP, MySQL, and Dropdown lists
Quote:
|
Re: PHP, MySQL, and Dropdown lists
Quote:
But a new question has arisen. My question now is, I need to get the value from the field after clicking on the submit button. Here's my code: PHP Code:
Mainly, I just need to select the correct belt from the table, and output who owns it so far. I don't mean to be seeming like I'm asking how to do this whole thing, I've just been working on this for the whole day, and it's starting to get underneath my skin here. ** PS: I know it sounds like wrestling here, I'm helping a friend on a summer project ** |
Re: PHP, MySQL, and Dropdown lists
Quote:
NOTE: This news script cannot be used directly, there are still a few errors. If you look at the code under the if($action == "edit") section, you will see where a form is outputted. The following is a line of code from that, the name of the variable is modified for clarity: PHP Code:
|
Re: PHP, MySQL, and Dropdown lists
So you have a table of just people that own belts? Interesting. I'd have just made a new row in your wrestler table (I'm assuming you have one) named like belt_owned. Then you could have done something like SELECT DISTINCT wrestler_name,belt_owned FROM wrestlers WHERE belt_owned IS NOT NULL. But maybe I'm missing something. And I didn't even answer your question. Or was it already answered. I got so lost in that post that I don't even remember the problem :P I just got home from work.. so.. uhh *runs into wall and falls over*
|
Re: PHP, MySQL, and Dropdown lists
Quote:
|
Re: PHP, MySQL, and Dropdown lists
Ahh yes -- I knew there was a function, just couldn't find it in the 3-second attention span I allotted myself .. :)
|
Re: PHP, MySQL, and Dropdown lists
Quote:
max: Thanks also :) The problem w/ it though, is that when I choose the item...nothing happens period (which could be because I'm not good at using dropdown lists). |
Re: PHP, MySQL, and Dropdown lists
Ok, a new problem and I've been trying to fix it for the past 2 hours. What I'm trying to do is update the database by finding the belt in the table "belt_owner", and updating who owns it. I can connect, and get the current owners of it. My problem is trying to change the ownership of it.
There's a belt ("TV"), and the current holder in the database is "Trent Sinn". Whenever I try to change ownership of the belt (like, I enter my name as the new owner), nothing happens. It goes to the page it's supposed to, but doesn't update the table, or display a warning. PHP Code:
|
| All times are GMT -5. The time now is 15:26. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi