I'm attempting to do a comparision between two tables. If I find a match, I need to copy data from one table and insert it into the other. I'm able to pull the data from the tables just fine, but I'm having issues with a nested loop I created. It only loops through and finds one result. When looking through the tables, there are 1000s of matches, so I assume I'm doing something wrong. My only guess is the use of fetch_object and how I'm using it. I attempted using fetch_assoc instead, but I get the same result:
$mysqli = mysqli_connect("127.0.0.1", "uname", "pword") or die("Can't connect to databse!");
mysqli_select_db($mysqli, "db_name") or die("Couldn't Select Database!");
$result = $mysqli->query('SELECT * FROM table_1');
$title = $mysqli->query('SELECT title FROM table_2');
if($result && $title){
while($t_row = $title->fetch_object()){
while($row = $result->fetch_object()){
$s_title = strtolower($t_row->title);
$m_title = strtolower($row->description);
if($s_title == $m_title) {
echo "Matched: $s_title <strong>with</strong> $m_title<br />";
break;
}
}
}
}