cirilobr Posted November 2, 2013 Share Posted November 2, 2013 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 Quote Link to comment Share on other sites More sharing options...
Guest Posted November 2, 2013 Share Posted November 2, 2013 Your looping through a <tr>, so every time it loops it's adding a new row Quote Link to comment Share on other sites More sharing options...
cirilobr Posted November 3, 2013 Author Share Posted November 3, 2013 sorry dude, i am newbie on this, if you can explain better to me... I wore mccodes for much time, but with nw engine i am not understanding too much and sorry for my english, i am from br .-. Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 3, 2013 Share Posted November 3, 2013 which mod is this one or is it one your doing yourself ? Quote Link to comment Share on other sites More sharing options...
cirilobr Posted November 3, 2013 Author Share Posted November 3, 2013 i am "trying" to do... ;ppp i want show the crimes side by side and i added image to the crimes... Quote Link to comment Share on other sites More sharing options...
Uridium Posted November 3, 2013 Share Posted November 3, 2013 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 Quote Link to comment Share on other sites More sharing options...
cirilobr Posted November 3, 2013 Author Share Posted November 3, 2013 maybe i can resolve this with div float:left? Quote Link to comment Share on other sites More sharing options...
cirilobr Posted November 3, 2013 Author Share Posted November 3, 2013 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>"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.