 |
|
07-24-2005, 06:07 PM
|
|
#1
|
 |
|
Fighter (Level 4)
Join Date: Jul 2005
Posts: 38
|
PHP drop down menu
Hi All, I am back with some new problems. I need to generate a drop down menu from a sql database and i have looked everywhere i can't get what i want. Here is an example of what i would like
Age selection in drop down menu will be ranges from 0-10 yrs. Depending from this selection the sql database will know how many products is left in the chosen age..
I have the same product but in different age, some I have 1 some 2 some 3 and so on...
Am i making any sence here... I am geting confused too...
I will love you forever if anyone can comeup with a scipt for me.
Azanaz
Last edited by azanaz : 07-24-2005 at 07:36 PM.
Reason: Wrong Title??
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 05:18 AM
|
|
#2
|
 |
|
Fighter (Level 4)
Join Date: Jul 2005
Posts: 38
|
I see I'm Making it hard, I need to know if its possible at all to create a table in my sql thathas the number of available items so that when one chooses it from the main website from a pull down menu the database automatcally know which size is being purchased. E.G this is the sql table i need:
ProductsID Units In Stock Product Description
1 1 size 9
2 1 size 10
3 2 size 11
4 1 size 12
5 1 Size 13
6 2 size 1
7 1 size 2
Pull down Menu: Size E.g Sizes 9,10,11,12,13,1,2 in a box.
Please please please you all, i really need to finish the website soon..
Many MAny Thanks for looking
Azanaz
Last edited by azanaz : 07-25-2005 at 06:40 AM.
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 06:23 AM
|
|
#3
|
 |
|
Mod of the Underlay
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
|
you could have two fields - one for upper age limit of a product and one for the lower age limit.
Then, if the select value is between those two fields, you can query for them:
Code:
$query = "SELECT * FROM products WHERE upper_age > ". $selected_age ." AND lower_age < ". $selected_age;
I've used PHP variable identifiers, as I am not sure what language you are using....
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 07:16 AM
|
|
#4
|
 |
|
Fighter (Level 4)
Join Date: Jul 2005
Posts: 38
|
Hi, Many Thanks, I am very very newbie here, At least there is someone out there who knows what i mean but i am still very confused as to what the code mean...could you pls explaine to me where i should put this code, I mean i know what i want but i can't get it round my head how to...I know you must be laughing now, but i am very determined to complete this thing and i know with help from you guys i will manage.
God Bless
Azanaz
P.s: I am using php. Many thanks.
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 07:46 AM
|
|
#5
|
 |
|
Mod of the Underlay
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
|
Okay, I'm getting a sense of "running before walking" here - don't worry about laughing, as we don't do that round here... well, we do.. but only when someone says something funny - not when you're asking questions like this... I used to ask questions like this, too...
anyways...
Do you know how to alter the table in the database so that you have the two fields?
Do you know how to connect your PHP script to the database?
Do you know how to write queries?
Answer those, and we can work from there
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 08:02 AM
|
|
#6
|
 |
|
Fighter (Level 4)
Join Date: Jul 2005
Posts: 38
|
Ok, I feel very stupid, i have been using books and online resources for now, i don't know a thing about PHP. I started out with html but since opening an accoung with oscommerce everything is in php so i haven't had the time to have lessons....Hope you can help, I am tring hard to make the website and your help would be very much appreciated.
Many Thanks
Azanaz
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 09:15 AM
|
|
#7
|
 |
|
Mod of the Underlay
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
|
hey - no need to feel stupid... you're just new to it... if you can't get to grips with it before the universe is sucked into a black hole, then you may just be dumb - but not being able to do something when you're starting out is fine (even I ask the odd question now and then, and I've been at this for years now).
Okay...
You need to find out if your PHP package on your server also includes a database (I assume it does).
http://uk2.php.net/manual/en/ref.mysql.php is the main reference for using PHP and MySQL, you don't need to worry about the installlation - your host will have sorted that out.
The other reference is the MySQL site itself - http://dev.mysql.com/doc/mysql/en/index.html
Start simple, and then expand
I can help with specific questions, but it's better for you to have a go first and then try and figure out why it breaks for yourself before posting questions.
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 09:36 AM
|
|
#8
|
 |
|
Fighter (Level 4)
Join Date: Jul 2005
Posts: 38
|
Yes I already have a sql database running, Luckily the ecommerce i use which is OS commerce comes preety much done, i just had to edit a few bits and pieces, The problem i am having is because it's already premade, i cannot seem to add things to it. Can I pm you with the site adddress coz my admin is not password protected at the moment and i am working on that, just not getting anywhere... If you go to the oscommerce page you will see all my products that i have(actually only 3) Because the rest i need to put them up but with the age selection drop down.
|
|
Add to del.icio.us
Can you digg it?
|
|
|
07-25-2005, 10:11 AM
|
|
#9
|
 |
|
Mod of the Underlay
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 17,350
|
go ahead and PM - I'll have a quick look tonight... just two things - I won't promise anything as far as fixing it goes (I do have a life outside of here too  ) and I really recommend you close up that security hole by sorting your access out...
|
|
Add to del.icio.us
Can you digg it?
|
|
|
KEEP TABS |
|
SPONSORS |
| |


|
| |
|
|
| |
|