Query Query

Codes here !

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 3
Joined: Wed Nov 13, 2002 8:04 am

Query Query

Postby andrewparker » Thu Dec 12, 2002 1:00 pm

I am new to SQL and am having trouble constructing an SQL Query.

Basically I have a database consisting of 3 tables, one called ILLNESS, one called PRODUCTS and one called PRODUCTLINK.

The PRODUCTLINK table contains an id linking to an illness and an id linking to a product.

I want a user to be able to enter the symptoms they have and for the database to return the illness they are suffering from and the products that will help them.

Can anyone help me with the query?


User avatar
Joan Garnet
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Postby Joan Garnet » Fri Dec 20, 2002 7:38 pm

You will need to make a search engine that looks for matches with the simptoms entered by the user and then outputs the values of the two differen tables.

Code: Select all

$sql = " SELECT * FROM  PRODUCTLINK  WHERE my_row LIKE '%".$my_var."%' ";

This will look in the row my_row of the table PRODUCTLINK for matches with the string $my_var.

This is a very simple search, but you can do as you want.

Return to “mySQL & php coding”

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests