I am trying to make an If statement in PHP loop for each row in an Sql table. I think I'm almost there but there is a syntax error that I cant quite figure out. Heres what i've got so far:
$mysqli = new mysqli("localhost", "root", "usbw", "favourites");
// check connection
if ($mysqli->connect_errno) {
die("Connect failed: ".$mysqli->connect_error);
}
$query = "SELECT * FROM defaultTiles";
$result = $mysqli->query($query);
while($row = $result->fetch_array()){
echo "<?php if ($tile_name === '$row[name]'){
$tile_colour = '$row[colour]';
$img_url = '$row[img_url]';
$link_url = '$row[link_url]';
} ?>";
}
Aucun commentaire:
Enregistrer un commentaire