Jump to content
  • 0

player of the month for fluxcp


Zezicla

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   1
  • Joined:  12/01/12
  • Last Seen:  

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; ?>
Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  29
  • Reputation:   1
  • Joined:  03/27/14
  • Last Seen:  

what seems to be the error on this line? can you post it here please?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   1
  • Joined:  12/01/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   1
  • Joined:  12/01/12
  • Last Seen:  

so how to fix that ? :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  29
  • Reputation:   1
  • Joined:  03/27/14
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   1
  • Joined:  12/01/12
  • Last Seen:  

no error i just doesnt shows

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  29
  • Reputation:   1
  • Joined:  03/27/14
  • Last Seen:  

so if that's the case,the table guild doesnt have any data yet...so there's nothing to fetch...

Edited by prokopio
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  70
  • Reputation:   18
  • Joined:  01/28/12
  • Last Seen:  

$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
Link to comment
Share on other sites

×
×
  • Create New...