Jump to content

Tealq

New Members
  • Posts

    5
  • Joined

  • Last visited

Tealq's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. In source code: <img src="./uploads/<br /> <b>Warning</b>: Trying to access array offset on value of type null in ..... the line where is img src. Anyway, you have a very nice profile picture! Yes, I checked the folder and image is in the folder. And yes, I have separate table for weapon images, but your way sound very good, Im going to try it. Many thanks.
  2. Hello, many thanks ! I tried before something with adding damage to player with mysql query, but this is what I wanted Simple and working, just player damage + weapon damage Can you help me with one more thing, please? Im trying get image for each weapon, but Im not success. I make inventory in table, all working, showin Weapon name, damage... but IMG not working. I uploaded images with php to mysql, but I have problem get the image. here is code: <?php $weaponid = $weapon3['id']; $weapimg="SELECT * from weaponimg where weaponid='$weaponid'"; $weapimg2=mysqli_query($connection, $weapimg); $weapimg3=mysqli_fetch_array($weapimg2); ?> <tr> <td><img src="./uploads/<?php $weapimg3['filename']?>"</td> <td><?php print "$weapon3[name]" ?> </td> <td><?php print "$weapon3[damage]" ?></td> <td><?php print "$weapon3[level]" ?></td> <td><?php print "$weapon3[equip]" ?></td> </tr> <?php } ?> </tbody> </table>
  3. Hello, Yes, I have weapon table with name, type and damage value for each weapon and yes, I mean player can have only one weapon at a time. Okay, Im learning php just 1 - 2 months, so I learning from videos on youtube and topics on forums, so the code is not very well Thank you for tips.
  4. Hello, I sorted this, now when I equip weapon, damage adding to the player and when weapon unequiped, weapon damage delete from player. But, I have still problem with inventory. When I equip weapon, still can equip more weapons from inventory. How to do: When weapon is equipped, cant equip another weapon until equiped weapon is enequipped? Here is code: Many thanks. while($inventory3=mysqli_fetch_array($inventory2)) { if ($inventory3['equip'] == 1) {$inventory3['equip'] = "Equipped <A href='equippedoff.php?weaponid=$inventory3[weaponid]&type=w'>Unequip";} else {$inventory3['equip'] = "<A href='equipped.php?weaponid=$inventory3[weaponid]&type=w'>equip";}
  5. Hello there, Im thinking about it and I dont know how to do it. That’s why Im asking here and I believe you can help me Im working on simple browser rpg, but I have a problem with codding inventory. My inventory works now like equip and unequip. I need add function, when I equip weapon, the weapon damage add to the player damage and when you want unequip weapon, the weapon damage delete from player damage. Can someone help me with this? Here is my code for equip: Many thanks! <?php $weaponid=$_GET['weaponid']; $reequip="UPDATE playeritem SET equip=0 WHERE pid='$id' AND equip=1"; mysqli_query($connection, $reequip) or die ("Problem with connection"); $equip="UPDATE playeritem set equip=1 where pid='$id' AND weaponid='$weaponid'"; mysqli_query($connection, $equip); echo "<big>Weapon equipped!<br></big>"; echo "<br><a href='inventory.php'>Go to inventory</a>" ?> </div>
×
×
  • 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.