0

Hello,

I am quite new to PHP and MySQL. Could anybody please help me with this problem?
Suppose I have a database like this,

[U]Type[/U]     [U]Name[/U]     [U]Price($)[/U]
 A       ABC      150
 A       DEF      350
 B       XYZ      250
 B       UVW      450
 C  .......................
.............................

The user is required to choose the type and enter the budget he can afford, given that he can only buy one of them.

For example, the user chooses type A and enters a budget of 400($). Then I want it to output something like, "You can buy ABC or DEF."

I would like to know how this can be written, roughly.
Please give me a hand, thanks in advance.

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by verruckt24
0

You could write a MySQL query for this like:

SELECT Name FROM tablename where type = '<type>' and price <= '<price>'

Once you have the result for this, you could show it using PHP.

0

Thanks.
I realized that my question is with the php side.
I'm going to learn more before asking again.
Tks anyways!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.