I have the following table:
Comments -------- id PK cid content uid comment
If the content is image
/i want it to print ?imgID=$cid
and get the data from the row title
from the table images
and if it's a thread I want it to print ?threadID=$cid
and get the title from the table threads
and so on. How should I do this?
<h3>Latest comments</h3>
<?php
$rs = mysql_query("
SELECT *
FROM comments
LEFT JOIN threads
ON threads.id = comments.cid
WHERE comments.uid = $id
");
while ($row = mysql_fetch_assoc($rs)) {
echo $row['title'];
}