Jump to content

[SOLVED] multiplications


richiec

Recommended Posts

Hey guys and girls, im stuck and could use a little help..

 

if you go here you will see a list of items:

 

http://fearedwarlords.dks-gfx.com/items/items.php

 

What i would like to do is at the top where it has the button "gem" when clicked it changes the stats of all the items to a set % +

 

Heres the code i have right now:

 


//gets the info from db//

$stock = mysql_result($result,$i,"stock");
$name = mysql_result($result,$i,"name");
$hitpoints=mysql_result($result,$i,"hitpoints");
$attack=mysql_result($result,$i,"attack");
$rage=mysql_result($result,$i,"rage");
$maxrage=mysql_result($result,$i,"maxrage");
$exp=mysql_result($result,$i,"exp");
$critical=mysql_result($result,$i,"critical");
$rampage=mysql_result($result,$i,"rampage");
$block=mysql_result($result,$i,"block");
$image=mysql_result($result,$i,"image");

//echos them all//

echo "
<tbody><tr>
<td colspan=\"2\" style=\"font-weight: bold; height: 20px; font-size: 10pt; color: rgb(204, 204, 204);\" align=\"left\">$name x $stock</td>
</tr>
<tr>
<td style=\"padding: 2px; font-family: Verdana; font-weight: bold; font-size: 7pt; color: rgb(255, 255, 255);\" align=\"left\" valign=\"top\">
<br>
$hitpoints Hit points<br>$attack Attack<br>$rage Rage per turn<br>$maxrage Max Rage<br>$exp Experience per turn <br>$rampage % Rampage<br>$critical % Critical hit<br>$block % Block <br><br>
</td>

<td style=\"width: 80px; font-family: Verdana; font-size: 7pt; color: rgb(255, 255, 255);\" align=\"center\" valign=\"top\">
<img src=\"$image\" style=\"border: 1px solid rgb(102, 102, 102); margin: 2px;\"></a><br>
<img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"><br>
<img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><br></td>			
</tr>
";

 

What i was thinking was something like...

 


///
if ($_REQUEST["Submit"] != NULL){
////

$hitpoints = ($hitpoints * 74%);
$attack = ($attack * 92%);
$rage = ($rage * 75%);
$exp = ($exp * 75%);
$maxrage = ($maxrage * 74%);
$rampage = ($rampage * 83%);

 

I know thats not right, and im abit of a noobie but any ideas on how i could do what im wanting to do?

Link to comment
https://forums.phpfreaks.com/topic/62522-solved-multiplications/
Share on other sites

ok i got that working, kind of it doesnt work out the % + for the gems right but i can mess with that once i get it fully working..

 

However the other thing wrong with it now, is that after it gets the info for the first item it breaks the table and displays all of the others outside of the table

 

http://fearedwarlords.dks-gfx.com/items/items.php if you look there you will see what i mean, any ideas?

it worked fine before i added the if.. else.. into it.. can you only have one echo using the if, else command?

 

This is the echo code...

 


if ($_REQUEST["gem"] != NULL){

//echos the gemmed stats//

$i++;

echo "
<tbody><tr>
<td colspan=\"2\" style=\"font-weight: bold; height: 20px; font-size: 10pt; color: rgb(204, 204, 204);\" align=\"left\">$name x $stock</td>
</tr>
<tr>
<td style=\"padding: 2px; font-family: Verdana; font-weight: bold; font-size: 7pt; color: rgb(255, 255, 255);\" align=\"left\" valign=\"top\">
<br>
$hitpoints2 Hit points<br>$attack2 Attack<br>$rage2 Rage per turn<br>$maxrage2 Max Rage<br>$exp2 Experience per turn <br>$rampage % Rampage<br>$critical % Critical hit<br>$block % Block <br><br>
</td>

<td style=\"width: 80px; font-family: Verdana; font-size: 7pt; color: rgb(255, 255, 255);\" align=\"center\" valign=\"top\">
<img src=\"$image\" style=\"border: 1px solid rgb(102, 102, 102); margin: 2px;\"></a><br>
<img src=\"http://fearedwarlords.dks-gfx.com/images/gem_green.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gem_blue.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gem_red.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gem_white.jpg\"><br>
<img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><br></td>			
</tr>
";

echo '</tbody></table></td></tr></tbody></table></center></div>';

} else {

//echos the ungemmed stats//

$i++;

echo "
<tbody><tr>
<td colspan=\"2\" style=\"font-weight: bold; height: 20px; font-size: 10pt; color: rgb(204, 204, 204);\" align=\"left\">$name x $stock</td>
</tr>
<tr>
<td style=\"padding: 2px; font-family: Verdana; font-weight: bold; font-size: 7pt; color: rgb(255, 255, 255);\" align=\"left\" valign=\"top\">
<br>
$hitpoints Hit points<br>$attack Attack<br>$rage Rage per turn<br>$maxrage Max Rage<br>$exp Experience per turn <br>$rampage % Rampage<br>$critical % Critical hit<br>$block % Block <br><br>
</td>

<td style=\"width: 80px; font-family: Verdana; font-size: 7pt; color: rgb(255, 255, 255);\" align=\"center\" valign=\"top\">
<img src=\"$image\" style=\"border: 1px solid rgb(102, 102, 102); margin: 2px;\"></a><br>
<img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"> <img src=\"http://fearedwarlords.dks-gfx.com/images/gemslot.jpg\"><br>
<img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><img src=\"http://fearedwarlords.dks-gfx.com/images/augslot.jpg\"><br></td>			
</tr>
";

echo '</tbody></table></td></tr></tbody></table></center></div>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.