Jump to content
  • 0

player of the month for fluxcp


Question

Posted

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; ?>

8 answers to this question

Recommended Posts

Posted

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 :D

Posted
$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.

Posted (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 by Choko Designoper
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...