I am having trouble with this PHP code and I am not sure how to title it! I have a car showcase and I am wanting the Database to display the cars depending on their ID e.g 1 Ferrari Enzo, 2 Porsche GT3RS. Here is my code:
<?php
include_once("php_includes/db_conx.php");
$sql = "SELECT carid, make, model FROM stock WHERE carid IN(1,2,3)";
$query = mysqli_query($db_conx, $sql);
echo mysqli_error($db_conx);
$stock = mysqli_fetch_assoc($query);
$stock['carid'];
$stock['model'];
$stock['make'];
?>
These are the cars.
<div class="view view-first">
<img src="http://ift.tt/1MYEcgN" />
<div class="mask">
<?php if ($stock["carid"] =='1') {
echo $stock['make'];
} else { echo $stock['make'];
} ?>
</section>
<section class="right-column"> <div class="view view-first">
<img src="http://ift.tt/1MYEdBm" />
<div class="mask">
<?php if ($stock["carid"] == '2') {
echo $stock['make'];
} else { echo "car does not exist";
} ?>
</div>
Sorry if I get this wrong, new here xD
Aucun commentaire:
Enregistrer un commentaire