Hello there. I'm joining tables that have some fields with the same name.
ie title.
but in the for loop i would like to specify which title to use as they are often different.
Is there a way to do this ?
function joinTables($table1, $table2, $q) {
$sql = "SELECT * FROM ".$table1." LEFT JOIN ".$table2." ON $q";
$recordSet = mysql_query($sql,$this->conn);
$results = array();
while ($row = mysql_fetch_assoc($recordSet)){
$results[]=$row;
}
return $results;
}
$assoc = $select->joinTables("contentAssoc", "content", "contentAssoc.refID=content.contentID WHERE contentAssoc.refID='".$directorContent['contentID']."' ORDER BY contentAssoc.position");
foreach($assoc as $row) {
echo $row['title'];
// how can i define which table it gets the value for the title field from?
// ie $row['LEFT.title']; or $row['contentAssoc.title']; (tried but no joy ;-()
}
many thnkas! Dan.