Zezicla Posted March 27, 2014 Posted March 27, 2014 i got this somewhere i cant seem to get this working <?php if (!defined('FLUX_ROOT')) exit; $query = "SELECT name, master FROM {$session->loginAthenaGroup->loginDatabase}.guild WHERE guild_id = ? "; $sth = $session->loginAthenaGroup->connection->getStatement($query); $sth->execute(array($gtheme_config['guild_id'])); $gtheme_gom = $sth->fetchAll(); ?> <ul id="pgom"> <?php if($gtheme_gom): ?> <?php foreach($gtheme_gom as $row): ?> <li> <img class="gom" src="<?php echo $this->emblem($row->guild_id) ?>" /> </li> <li id="lbl" ><b>Guild: </b> <?php echo ($row->name)?$row->name:'???' ?></li> <li id="lbl" ><b>GM: </b> <?php echo ($row->master)? $row->master:'???' ?></li> <?php endforeach; ?>
prokopio Posted March 28, 2014 Posted March 28, 2014 what seems to be the error on this line? can you post it here please?
Zezicla Posted March 28, 2014 Author Posted March 28, 2014 i think the error is in this lines <li id="lbl" ><b>Guild: </b> <?php echo ($row->name)?$row->name:'???' ?></li> <li id="lbl" ><b>GM: </b> <?php echo ($row->master)? $row->master:'???' ?></li> but ive some1 who knows this shit can look at it
Emistry Posted March 28, 2014 Posted March 28, 2014 $query = "SELECT name, master FROM {$session->loginAthenaGroup->loginDatabase}.guild WHERE guild_id = ? "; hmm ?? guild_id = ? pick entry based on "unknown" guild_id ?? make sure you bind it / declared it somewhere... before you fetch all the data.
prokopio Posted March 28, 2014 Posted March 28, 2014 what error does it shows exactly when you run that code?if it doesnt and only an empty query..hince, there's no data fetched by that query...
prokopio Posted March 29, 2014 Posted March 29, 2014 (edited) so if that's the case,the table guild doesnt have any data yet...so there's nothing to fetch... Edited March 29, 2014 by prokopio
Aries Posted May 4, 2014 Posted May 4, 2014 (edited) $sth->execute(array($gtheme_config['guild_id'])); where do you get the $gtheme_config['guild_id']? The code seem to work though. Notice that I added a guild id there which I cannot see on your code. <?php if (! defined('FLUX_ROOT')) exit; $guild_id = 1; // <- guild id $sql = "SELECT name, master FROM {$server->charMapDatabase}.guild WHERE guild_id = ?"; $sth = $server->connection->getStatement($sql); $sth->execute(array($guild_id)); $gtheme_gom = $sth->fetch(); // just use fetch since you only expect one result unless .. ?> <ul id="pgom"> <li> <img class="gom" src="<?php echo $this->emblem($guild_id); ?>" /> </li> <li id="lbl" ><b>Guild: </b> <?php echo $gtheme_gom ? $gtheme_gom->name : '???'; ?></li> <li id="lbl" ><b>GM: </b> <?php echo $gtheme_gom ? $gtheme_gom->master : '???'; ?></li> </ul> Edited May 4, 2014 by Choko Designoper
Question
Zezicla
i got this somewhere i cant seem to get this working
8 answers to this question
Recommended Posts