Forum Moderators: coopster
$query2="SELECT * FROM incident_news_subscript LEFT JOIN incident_news ON incident_news.id=incident_news_subscript.relation WHERE username='$coment_auth_name'";
$result2= mysql_query($query2) or die('Error : ' . mysql_error());
while($row2 = mysql_fetch_array($result2)){
And this output file.
echo "<tr><td>".$row2['type']."</td><td>".$row2['services']."</td><td>".$row2['Title']."</td><td>".$row2['time']."</td><td><span class=\"form\"><a href=\"".ADMIN."SQL_edit_subscript.php?del=".$row2['incident_news_subscript.id']."\" title=\"Dzēst šo pierakstu\">Dzēst</a></span>".$edit."</td></tr>";
unset($edit); What i would like to know, is how to use this $row2['incident_news_subscript.id'] part correctly, so that i get a value here, because now, I am not getting any.
Any help?
Thanks!
I recommend stating the column names required from each table and using an INNER JOIN if you want only those rows where rows exist in both tables for any given id. If not, you will have to check for NULL values in the right hand table columns to determine whether or not a corresponding row was located and joined. Also, you can eliminate any column ambiguity by preceding the column name with the table name:
$query2 =
"SELECT
incident_news_subscript.relation,
which-table-here.type,
which-table-here.services,
which-table-here.Title,
which-table-here.time
FROM incident_news_subscript
LEFT JOIN incident_news ON(incident_news_subscript.relation = incident_news.id)
WHERE
username = '$coment_auth_name'"
;