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.

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.

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

well if the query has been solved mark the thread so.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.