Jump to content
MakeWebGames

Recommended Posts

Posted

am i doing this right, i wanna set it up so that the stats and all that is next to each other this is what i got but it kills the page

 

<?php
$housequery=1;
include_once "globals.php";
echo '<table width="100%"><tr>
   <td width="25%">
       <table width="100%"><tr>
           <td><center><h3>General Info:</h2></center></td><tr>
$exp=(int)($ir['exp']/$ir['exp_needed']*100);
$m=$db->query("SELECT * FROM users WHERE userid='{$ir['married']}'"); $par=$db->fetch_row($m);
if($ir['married'] > 0) { $partner= "[url='viewuser.php?u={$par[']<font color=green>{$par['username']}</font>[/url] [<a href=marriage.php>Manage Marriage</a>]"; } else { $partner= "<font color=red>N/A</font>"; }
<td>[b]Name:[/b] {$ir['username']}</td><td>[b]Crystals:[/b] {$cm}</td></tr><tr>
<td>[b]Level:[/b] {$ir['level']}</td>td>[b]Exp:[/b] {$exp}%</td></tr><tr>
<tr><td>[b]Property:[/b] {$ir['hNAME']}</td><td>[b]Money:[/b] $fm</td></tr><tr>
<td>[b]Married:[/b] $partner</td><td>[b]HP:[/b]</td></tr>
<td>[b]Rank:[/b]</td></tr>
       </tr></table>
   </td><td width="25%">
       <table width="100%"><tr>
           <td><center><h3>Stats Info:</h3></center></td></tr>
$ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ'];
$ir['strank']=get_rank($ir['strength'],'strength');
$ir['agirank']=get_rank($ir['agility'],'agility');
$ir['guarank']=get_rank($ir['guard'],'guard');
$ir['labrank']=get_rank($ir['labour'],'labour');
$ir['IQrank']=get_rank($ir['IQ'],'IQ');
$tsrank=get_rank($ts,'strength+agility+guard+labour+IQ');
$ir['strength']=number_format($ir['strength']);
$ir['agility']=number_format($ir['agility']);
$ir['guard']=number_format($ir['guard']);
$ir['labour']=number_format($ir['labour']);
$ir['IQ']=number_format($ir['IQ']);
$ts=number_format($ts);
<td>[b]Strength:[/b] {$ir['strength']} [Ranked: {$ir['strank']}]</td>
<td>[b]Agility:[/b] {$ir['agility']} [Ranked: {$ir['agirank']}]</td>
</tr>
<tr><td>[b]Guard:[/b] {$ir['guard']} [Ranked: {$ir['guarank']}]</td><td>[b]Labour:[/b] {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr>
<tr><td>[b]IQ: [/b] {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td><td>[b]Total stats:[/b] {$ts} [Ranked: $tsrank]</td>
       </tr></table>
   </td></tr>
</table>';

$q=$db->query("SELECT * FROM items WHERE itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']}, {$ir['equip_armor']})");
echo "<h3>Equipped Items</h3><hr />";
while($r=$db->fetch_row($q))
{
$equip[$r['itmid']]=$r;
}
echo "<table width='75%' Border='1' cellspacing='1' class=''>
<tr>
<th>Primary Weapon</th>
<td>";
if($equip[$ir['equip_primary']]['itmid'])
{
print $equip[$ir['equip_primary']]['itmname']."</td><td>[url='unequip.php?type=equip_primary']Unequip Item[/url]</td>";
}
else
{
echo "None equipped.</td><td></td>";
}
echo "</tr>
<tr>
<th>Secondary Weapon</th>
<td>";
if($equip[$ir['equip_secondary']]['itmid'])
{
print $equip[$ir['equip_secondary']]['itmname']."</td><td>[url='unequip.php?type=equip_secondary']Unequip Item[/url]</td>";
}
else
{
echo "None equipped.</td><td></td>";
}
echo "</tr>
<tr>
<th>Armor</th>
<td>";
if($equip[$ir['equip_armor']]['itmid'])
{
print $equip[$ir['equip_armor']]['itmname']."</td><td>[url='unequip.php?type=equip_armor']Unequip Item[/url]</td>";
}
else
{
echo "None equipped.</td><td></td>";
}
echo "</tr>
</table><hr />
<h3>Inventory</h3><hr />";
$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$userid} ORDER BY i.itmtype ASC, i.itmname ASC");
if ($db->num_rows($inv) == 0)
{
echo "[b]You have no items![/b]";
}
else
{
echo "[b]Your items are listed below.[/b]

<table width=100% class=\"\" border=\"1\" cellspacing=\"1\">
<tr style='background:darkred;'>
<td class=\"\">Item</td>
<td class=\"\">Sell Value</td>
<td class=\"\">Total Sell Value</td>
<td class=\"\">Links</td>
</tr>";
$lt="";
while($i=$db->fetch_row($inv))
{
if($lt!=$i['itmtypename'])
{
$lt=$i['itmtypename'];
echo "\n<tr><td colspan=4>[b]{$lt}[/b]</td></tr>";
}
if($i['weapon'])
{
 $i['itmname']="<font color='red'>*</font>".$i['itmname'];
}
if($i['armor'])
{
 $i['itmname']="<font color='green'>*</font>".$i['itmname'];
}
echo "<tr><td>{$i['itmname']}";
if ($i['inv_qty'] > 1)
{
echo "x{$i['inv_qty']}";
}
echo "</td><td>\${$i['itmsellprice']}</td><td>";
echo "$".($i['itmsellprice']*$i['inv_qty']);
echo "</td><td>[[url='iteminfo.php?ID={$i[']Info[/url]] [[url='itemsend.php?ID={$i[']Send[/url]] [[url='itemsell.php?ID={$i[']Sell[/url]] [[url='imadd.php?ID={$i[']Add To Market[/url]]";
if($i['effect1_on'] || $i['effect2_on'] || $i['effect3_on']) {
echo " [[url='itemuse.php?ID={$i[']Use[/url]]";
}
// -- Donation Module -- //
require_once('gateway/donation_functions.php');
$dset = getSettings();

if($i['itmtype'] == $dset['item_type']) {
echo ' [[url="donate.php?use_item='.$i['inv_id'].'"]Use[/url]]';
}
// -- Donation Module -- //
if($i['weapon'])
{
echo " [[url='equip_weapon.php?ID={$i[']Equip as Weapon[/url]]";
}
if($i['armor'])
{
echo " [[url='equip_armor.php?ID={$i[']Equip as Armor[/url]]";
}
echo "</td></tr>";
}
echo "</table>";
echo "[size="1"][b]NB:[/b] Items with a small red [/size]<font color='red'>*</font>[size="1"] next to their name can be used as weapons in combat.

Items with a small green [/size]<font color='green'>*</font>[size="1"] next to their name can be used as armor in combat.[/size]";
}
	$_POST['pn_update'] = ( isset($_POST['pn_update']) )?strip_tags($db->escape($_POST['pn_update'])):'';
    if ( !empty($_POST['pn_update']) ) {
      if (  strlen($_POST['pn_update']) > 500 ) {
  echo '<hr><span style="font-weight:bold;">You may only enter 500 or less characters here.</span>';
      } else {
$db->query("UPDATE users SET user_notepad='{$_POST['pn_update']}' WHERE userid=$userid");
	$ir['user_notepad']=stripslashes($_POST['pn_update']);
  echo '<hr><span style="font-weight:bold;">Personal Notepad Updated!</span>';
      }
    }
echo "<hr>Your Personal Notepad:<form action='index.php' method='post'>
<textarea rows='10' cols='50' name='pn_update'>".htmlspecialchars($ir['user_notepad'])."</textarea>

<input type='submit' value='Update Notes' /></form>";
$h->endpage();
?> 

 

If anyone can help be great, its ok if i just have text and none of the {$ir['username']} and such

Posted

You're using single quotes on your echo tag meaning you cannot just put in {$ir['username']} you'll need to break away from the tags then print the variable out such like this...

<?php
echo '<div>Welcome back '.$ir['username'].'</div>';
?>
Posted

and total stats,

but thanks a heap your a life saver

this what i got

 

echo '<table width="100%"><tr>
   <td width="25%">
       <table width="100%"><tr>
           <td><center><font size=+1><h3>General Info:</h2></font></center></td><tr>

<td>[b]Name:[/b] '.$ir['username'].'</td><td>[b]Crystals:[/b] '.$ir['crystals'].'</td></tr><tr>
<td>[b]Level:[/b] '.$ir['level'].'</td><td>[b]Exp:[/b]'.$ir['$exp'].'%</td></tr><tr>
<tr><td>[b]Property:[/b] '.$ir['hNAME'].'</td><td>[b]Money: $[/b]'.$ir['money'].'</td></tr><tr>
<td>[b]Married:[/b] '.$ir['$partner'].'</td><td>[b]HP:'.$ir['hp'].'/'.$ir['maxhp'].'[/b]</td></tr>
<td>[b]Rank:[/b]</td></tr>

       </tr></table>
   </td><td width="25%">
       <table width="100%"><tr>
           <td><center><font size=+1><h3>Stats Info:</h3></font></center></td></tr>

<td>[b]Strength:[/b] '.$ir['strength'].' [Ranked: '.$ir['strank'].']</td>
<td>[b]Agility:[/b] '.$ir['agility'].' [Ranked: '.$ir['agirank'].']</td>
</tr>
<tr><td>[b]Guard:[/b] '.$ir['guard'].' [Ranked: '.$ir['guarank'].']</td><td>[b]Labour:[/b] '.$ir['labour'].' [Ranked: '.$ir['labrank'].']</td></tr>
<tr><td>[b]IQ: [/b] '.$ir['IQ'].' [Ranked: '.$ir['IQrank'].']</td><td>[b]Total stats:[/b] '.$ir['$ts'].' [Ranked: '.$ir['$tsrank'].']</td></tr>

       </tr></table>
   </td></tr>
Posted

You made a few mistakes, try using this code instead.

echo '<table width="100%"><tr>
   <td width="25%">
       <table width="100%"><tr>
           <td><center><font size=+1><h3>General Info:</h2></font></center></td><tr>

<td>[b]Name:[/b] '.$ir['username'].'</td><td>[b]Crystals:[/b] '.$ir['crystals'].'</td></tr><tr>
<td>[b]Level:[/b] '.$ir['level'].'</td><td>[b]Exp:[/b]'.$ir['exp'].'%</td></tr><tr>
<tr><td>[b]Property:[/b] '.$ir['hNAME'].'</td><td>[b]Money: $[/b]'.$ir['money'].'</td></tr><tr>
<td>[b]Married:[/b] '.$ir['$partner'].'</td><td>[b]HP:'.$ir['hp'].'/'.$ir['maxhp'].'[/b]</td></tr>
<td>[b]Rank:[/b]</td></tr>

       </tr></table>
   </td><td width="25%">
       <table width="100%"><tr>
           <td><center><font size=+1><h3>Stats Info:</h3></font></center></td></tr>

<td>[b]Strength:[/b] '.$ir['strength'].' [Ranked: '.$ir['strank'].']</td>
<td>[b]Agility:[/b] '.$ir['agility'].' [Ranked: '.$ir['agirank'].']</td>
</tr>
<tr><td>[b]Guard:[/b] '.$ir['guard'].' [Ranked: '.$ir['guarank'].']</td><td>[b]Labour:[/b] '.$ir['labour'].' [Ranked: '.$ir['labrank'].']</td></tr>
<tr><td>[b]IQ: [/b] '.$ir['IQ'].' [Ranked: '.$ir['IQrank'].']</td><td>[b]Total stats:[/b] '.$ir['ts'].' [Ranked: '.$ir['tsrank'].']</td></tr>

       </tr></table>
   </td></tr>

You forgot to add a single quote after $ir['$tsrank'] along with the fact it should actually be $ir['tsrank']. Same issue with exp you had a $ in the variable.

EDIT:

For some weird reason it's not showing the ' I've added in. So the code probably wont work. Stupid WBB.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...