Ok basically I need to select the submitted_link row in image 1 based on the tab_id from image 1 and id from image 2 (the join). After this is selected I need to update the tab_content row in image 2 for each of the id's in image 2. Below the images is what I have code wise right now.
Image 1:
Database Help http://bekustom.com/Untitled-1.jpg
Image 2:
Database Help http://bekustom.com/Untitled-2.jpg
My Code:
$sql = ("SELECT submitted_links.submitted_link, submitted_links.tab_id, users_tabs.id FROM users_tabs, submitted_links WHERE submitted_links.tab_id=users_tabs.id AND submitted_links.user_id=users_tabs.user_id");
$result = mysqli_query($db, $sql);
while($row = $result->fetch_array()) {
$rows[] = $row;
}
foreach($rows as $row) {
$tab_content[] = $row['submitted_link'];
$tab_id = $row['tab_id'];
$tab_implode = implode(",", $tab_content);
$sql2 = ("UPDATE users_tabs SET tab_content='".$tab_implode."' WHERE id='".$tab_id."'");
$result2 = $db->query($sql2);
}
What I'm getting in tab_content currently:
ID 17: http://google.com,http://twitter.com,http://google2.com
ID 18: http://google.com,http://twitter.com
Desired data in tab_content:
ID 17: http://google.com,http://google2.com
ID 18: http://twitter.com