Php, mysql help needed..... please assist...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
vonnero
Forum Newbie
Posts: 17
Joined: Tue Feb 17, 2009 6:19 am

Php, mysql help needed..... please assist...

Post by vonnero »

I am trying to display records ...where in table 1(member1d=8) and also where (table2.itemid=table1.postid)

I am not quit sure how to get around it the right way.....

I need help. Thanks.


table 1
+--------+--------+----------+
| joinid | postid | memberid |
+--------+--------+----------+
| 1 | 3 | 8 |
| 2 | 4 | 8 |
| 3 | 5 | 8 |
| 4 | 7 | 8 |
| 5 | 10 | 8 |
+--------+--------+----------+


table 2
+----+----------+----------+---------------------+-------------------------+----
--------------------------------+
| id | itemid | posterid | postdate | title | mypost |
+----+----------+----------+---------------------+-------------------------+----
--------------------------------+
| 1 | 4 | 8 | 2009-02-23 03:06:07 | problem with my work... | am just testing to see if its ok..
|
| 2 | 9 | 7 | 2009-02-23 03:14:17 | this is for | tes ting again to see
|
| 3 | 21 | 8 | 2009-02-26 14:22:05 | it is ok? | I am having a problem
|
| 4 | 1 | 3 | 2009-02-26 22:21:03 | hi | hi
|
| 5 | 10 | 5 | 2009-02-26 22:24:20 | hi | hi
|
+----+----------+----------+---------------------+-------------------------+----
--------------------------------+




V
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Php, mysql help needed..... please assist...

Post by Benjamin »

Code: Select all

 
SELECT
  t1.*,
  t2.*
FROM
  table1 t1,
  table2 t2
WHERE
  t1.memberid = '8'
  AND t2.itemid = t1.postid
 
Post Reply