I have 3 tables :
tb_wrapper tb_doc tb_aut
===================== ==================== =======================
|id|web|title|source| |id| web | content | |id|web|aut | linkAut|
===================== ==================== =======================
|1 | A | AA | AAA | |1 | A | AAAA | |1 | A | B | C |
===================== ==================== |2 | A | D | E |
=======================
I wanna get all of record data from 3 table that has same web.
here’s my code :
$query = mysql_query("
SELECT
tb_wrapper.web,
tb_wrapper.title,
tb_wrapper.source,
tb_doc.web,
tb_doc.content,
tb_aut.web,
tb_aut.aut,
tb_aut.linkAut
FROM
tb_doc
INNER JOIN tb_wrapper ON tb_doc.web = tb_wrapper.web
AND
INNER JOIN tb_aut ON tb_doc.web = tb_aut.web
");
The error problem :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\sukses\indexsummary.php on line 87.
EDIT
Then I wanna print them all :
while ($row = mysql_fetch_array($query)) {
$source = $row['source'];
$title = $row['title'];
$content = $row['content'];
$aut = $row['aut'];
$linkAut = $row['linkAut'];
echo '<h2><a href='.$source.'> '.$title.' </a></h2>';
echo '<p><a href='.$aut_url.'> '.$aut.' </a></p>';
}
And the result, they are printed twice. AA B and AA D. How to make them AA B D ?
Please help me. thanks in advance 🙂
YOu need to remove the AND between inner joins, that’s invalid syntax.