Jump to content
MakeWebGames

Display crimes side by side


cirilobr

Recommended Posts

Hi, i'm trying to show the crimes side by side in two column

like:

Crime1 Crime2

in the engine show:

Crime1

Crime2

the code is:

 

TableHeader("Crimes");
echo "<table class='plainTable'>";
$result = $db->Execute("select crime_id,name,description,condition_code,success_rate,stat_cost,jail_time,crime_pic from crimes order by crime_id");
foreach ($result as $row)
{
   echo "<tr valign='top'>";
   $res = true;
   if ($row[3] != null && $row[3] != "")
       $res = NWEval("return {$row[3]};");
   if ($row[5] > $userStats[GetConfigValue("CrimeStatCost", "crime")]->value)
       $res = false;
   echo "<td width='1%'>";
   echo "<img src='$row[7]'/>";
   echo "</td>";
   $perc = 100;
   if ($row[4] != null && $row[4] != "")
       $perc = round(NWEval("return {$row[4]};") * 100.0, 0);
   if ($perc > 100)
       $perc = 100;
   echo "<td><b>" . Translate($row[1]) . ":</b><br>" . Translate($row[2]) . "<br><br>";
   echo Translate("<font color='green'><b>Success rate") . ": $perc%</b></font><br>" . Translate("<font color='red'><b>Cost") . ": {$row[5]}</b></font><br>";
   LinkButton('Do it', 'index.php?p=crime&id={$row[0]}', null, null, false, $res);
   echo "</td>";
   echo "</tr>";
}
$result->Close();
echo "</table>";

 

how to do this?

thx guys

Link to comment
Share on other sites

it wont do what you want as EVERYTHING is being listed on CRIME1 if you do try to do it on CRIME2 it will be a mirror image of CRIME1 this was a problem I encountered some time ago with another script

- - - Updated - - -

cos what your wanting is like

CRIME1 CRIME2

---------- ---------

RUN ESCAPE

CHARGE FART

 

and so on

Link to comment
Share on other sites

solved ;P thx

echo "<table class='plainTable'>";
$result = $db->Execute("select crime_id,name,description,condition_code,success_rate,stat_cost,jail_time,crime_pic from crimes order by crime_id");
$i = 1;
$numofcols = 2;
foreach ($result as $row)
{
   if( $i % $numofcols == 1 ){
   echo "<tr valign='top'>";
   }
   $res = true;
   if ($row[3] != null && $row[3] != "")
       $res = NWEval("return {$row[3]};");
   if ($row[5] > $userStats[GetConfigValue("CrimeStatCost", "crime")]->value)
       $res = false;
   echo "<td width='1%'>";
   echo "<img src='$row[7]'/>";
   echo "</td>";
   $perc = 100;
   if ($row[4] != null && $row[4] != "")
       $perc = round(NWEval("return {$row[4]};") * 100.0, 0);
   if ($perc > 100)
       $perc = 100;
   echo "<td><b>" . Translate($row[1]) . ":</b><br>" . Translate($row[2]) . "<br>";
   echo Translate("Success rate") . ": $perc%<br>" . Translate("Cost") . ": {$row[5]}";
   LinkButton("Do it", "index.php?p=crime&id={$row[0]}", null, null, false, $res);
   echo "</td>";
   if( $i % $numofcols == 0) {
     echo '</tr>'; //Close Row.
   }
   $i = $i + 1;
 }
if( ($i % $numofcols) > 0){
echo '</tr>';
}
$result->Close();
echo "</table>";
Link to comment
Share on other sites

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