I have a table as follows
Ads Table
user_id ad_id title message repost_days_id repost_times_id
1 1 Message Title 1 Message 1 1
1 1 Message Title 2 Message 0 0
Repost Days Table:
repost_days_id Value
1 5
Repost Times Table:
Repost_times_id value
1 10
Now I want to query the ads table to show ads with the ads title ads message repost days and repost times. For example it for ad 1 it will be
Message Title 1
Message Repost Days=10
Repost Times=5.
How do I write the sql statement for that? This is what I have done and is not displaying any result.
$q = "
select
a.ad_id,
a.title,
a.message,
rt.value,
rd.value,
from
ad_repost_times rt,
ad_repost_days rd,
ads a
where
a.user_id='{$_SESSION['user_id']}'
and rt.repost_times_id=a.repost_times_id
and rd.repost_days_id=a.repost_days_id
";