Trying to query two tables and I can't figure out how
09:01 01 Feb 2012

The first is the place table where the general information is kept and the second is the wait table where users sign up (like a waiting list)

+---------+--------------+------+-----+-------------------+----------------+
| Field   | Type         | Null | Key | Default           | Extra          |
+---------+--------------+------+-----+-------------------+----------------+
| id      | int(11)      | NO   | PRI | NULL              | auto_increment | 
| name    | varchar(30)  | YES  |     | NULL              |                | 
| userid  | int(3)       | YES  |     | NULL              |                | 
| address | varchar(300) | YES  |     | NULL              |                | 
| desc    | varchar(550) | YES  |     | NULL              |                | 
| phone   | int(15)      | YES  |     | NULL              |                | 
| image   | varchar(50)  | YES  |     | NULL              |                | 
| website | varchar(100) | YES  |     | NULL              |                | 
| cat     | varchar(25)  | YES  |     | NULL              |                | 
| date    | timestamp    | NO   |     | CURRENT_TIMESTAMP |                | 
+---------+--------------+------+-----+-------------------+----------------+


+----------+-----------+------+-----+-------------------+----------------+
| Field    | Type      | Null | Key | Default           | Extra          |
+----------+-----------+------+-----+-------------------+----------------+
| id       | int(11)   | NO   | PRI | NULL              | auto_increment | 
| userid   | int(11)   | YES  |     | NULL              |                | 
| place_id | int(11)   | YES  |     | NULL              |                | 
| date     | timestamp | NO   |     | CURRENT_TIMESTAMP |                | 
+----------+-----------+------+-----+-------------------+----------------+

For now I m doing a SELECT * FROM place; and displaying the data on the home page. Something like tihs:


name; ?>; userid; ?> etc ...
Click this to insert your userid and $place->id into wait table

This is where I got lost. I would like to do something like:


You already registered for this!

Click this to insert your userid and $place->id into wait table

Not sure if it's better to check for the user's id in the model that adds data to the wait table or to check in the model that grabs data for the home page. From what I've read, the second option would be better. Or should I use two separate queries ?

php mysql codeigniter model-view-controller left-join