SOLVED: Seems like my server was having issues and was not letting me properly ftp my files. So this whole time my code was correct :/ Just wasted hours of my time! THANKS GO DADDY!
I want to be able to join these two tables on the market_name of table_cars and name of table_price. I want to pull color and market_name of table_cars, and lowest_price and highest_price of table_price. But i only want cars with the market_name like 3 series. Can anyone tell me how to select this?
table_cars
ID market_name color volume
-----------------------------------------------------
1 BMW M3 alpine white 2
2 BMW 3 series blue 4
3 BMW 4 series black 4
table_price
ID name lowest_price highest_price sale_price
--------------------------------------------------------------------
1 BMW M3 55000 65000 50000
2 BMW 3 series 35000 42000 30000
3 BMW 4 series 40000 47000 35000
I have tried the query below but does not seem to be working.
$sql = "SELECT
table_cars.market_name,
table_cars.color,
table_price.lowest_price,
table_price.highest_price
FROM table_cars INNER JOIN table_price
ON table_cars.market_name=table_price.name
WHERE market_name LIKE '%3 series%'";
When I echo out the results, nothing appears. Not even "0 results".
$result = $connect->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo
"<div class='col-lg-4 col-md-6 col-sm-6 col-xs-12'>
<div class='x_panel tile fixed_height_panel'>
<div class='x_title name'>
<h2>" . $row["color"]. " " . $row["market_name"]. "</h2><br/>
" . $row["lowest_price"]. " - " . $row["highest_price"]. "
</div>
</div>
</div>";
}
} else {
echo "0 results";
}