MySQL Forums
Forum List  »  PHP

I WANT TO ECHO OUT DATA WITH THE SAME NAME BUT DIFFERENT DATA
Posted by: tosan ayodele
Date: June 07, 2017 02:55PM

Hello i need your help, im a php programmer and am having challenge echoing out multiple data with similar group name.I have two tables named groups and news, in my group i have columns named id, name. in my news table i have id, events name. Am trying to use the left join mysql query to echo out data with similar names. This is my code :

// Events
$sql = 'SELECT n.*, g.name FROM news AS n LEFT JOIN groups AS g ON n.name = g.name WHERE g.name = "'.$g.'"';
$query = mysqli_query($db_conx, $sql);
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$events=$row['events'];
/*echo $row['events'];
echo "<br>";*/
}


<?php echo $events;?>

Options: ReplyQuote


Subject
Written By
Posted
I WANT TO ECHO OUT DATA WITH THE SAME NAME BUT DIFFERENT DATA
June 07, 2017 02:55PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.