Currently, the below code is displaying the $ids array...
how can I echo only 1 id from it? I want to echo each id differently and not all at once. right now its echo's all 4 ids at once. I wish to echo them individually its working like echoing all emblem images mentioned in the $ids. i want them to be echo individually and not by foreach i want it to be echo something like
emblem($guild->guild_id of $ids=1);?>
emblem($guild->guild_id of $ids=2);?> emblem($guild->guild_id of $ids=3);?> and so on...
below is the code,
<?php
$castleNames = Flux::config('CastleNames')->toArray();
$ids = "1,2,3,4";
$sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_len FROM {$server->charMapDatabase}.guild_castle AS castles ";
$sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id ";
$sql .= "WHERE castles.castle_id IN ($ids)";
$sql .= "ORDER BY castles.castle_id ASC";
$sth = $server->connection->getStatement($sql);
$sth->execute(array_keys($castleNames));
$castles = $sth->fetchAll();
?>
<?php if ($castles): ?>
<?php foreach ($castles as $guild): ?>
<div class="flag">
<img width="24" src="<?php echo $this->emblem($guild->guild_id) ?>">
</div>
<?php endforeach ?>
<?php endif ?>
Thanks in advance note i have a very very basic knowledge of phpmysql, very beginner stage