Jump to content

help with query formulation


co.ador

Recommended Posts

hi

 

This query will display all the restaurants fields when the r.foodtypes_id equals rf.foodtypes_id

 

$query3= "SELECT r.*

FROM restaurants r

INNER

JOIN

foodtypes rf

ON

r.foodtypes_id = rf.foodtypes_id

";

 

I am looking for a query where it only displays the restaurants names only when r.foodtypes_id identical or equal to rf.foodtypes_id.  example

1 = 1
r.foodtypes_id = r.foodtypes_id

 

then when that conditions happens then it will display only the restaurants names that has 1 as the value for the r.foodtypes_id field. Right now the query will display all the columns and rows of the restaurants table when the condition

1 = 1
r.foodtypes_id = r.foodtypes_id

is met and I don't want to display all the name.

 

tableilustration.th.gif

 

In the image above I want restaurants "ca" and "tu" display in pagex.php when a user chooses russian food in the table foodtypes..

 

But right now as the query is it will display all the fields, it's columns and rows... i only want to display selected rows display only when restaurant x when user x chooses, foodtype x?

 

The restaurant x specializes in foodtype x therefore restaurant x will only display in the screen

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.