Jump to content
MakeWebGames

Recommended Posts

Posted (edited)

I have to do what you say and replace with that, it's work, i dont become error but i don't see that picture...Any solution? Something wrong on my code?

 

<?php

include "globals.php";

//look up item

$_GET['ID'] = abs((int) $_GET['ID']);

$itmid=$_GET['ID'];

if(!$itmid)

{

print "Invalid item ID";

}

else

{

$q=$db->query("SELECT i.*,it.* FROM items i LEFT JOIN itemtypes it ON i.itmtype=itmtypeid WHERE i.itmid=$itmid LIMIT 1");

if (!$db->num_rows($q))

{

print "Invalid item ID";

}

else

{

$id=$db->fetch_row($q);

if($id['itmpic']) {

$itmpic = "<tr style='background: gray;'><td colspan='2' style='text-align: center;'><img src='itmpics/$id'></td></tr>"; }

print "<table width=75% class='table' cellspacing='1'><tr style='background: gray;'><th colspan=2><b>Looking up info on {$id['itmname']}</b></th></tr>$itmpic<tr bgcolor=#dfdfdf><td colspan=2>The <b>{$id['itmname']}</b> is a/an {$id['itmtypename']} <span class='highlight'>Item</span> - <b>{$id['itmdesc']}</b></th><tr style='background: gray;'><th colspan=2><span class='highlight'>Item</span> Info</th></tr><tr style='background:gray'><th><span class='highlight'>Item</span> Buy Price</th><th><span class='highlight'>Item</span> Sell Price</th></tr><tr><td>";

if($id['itmbuyprice'])

{

print money_formatter($id['itmbuyprice']);

}

else

{

print "N/A";

}

print "</td><td>";

if($id['itmsellprice'])

{

print money_formatter($id['itmsellprice']);

}

else

{

print "N/A</td></tr></table>";

}

}

}

$h->endpage();

?>

Edited by S.Cosmin
Posted

Well my suggestion would be for you to learn from your mistakes. View the source code and/or inspect the element in question.

It will clearly show you where your going wrong. There is no image as your not calling the image correctly.

<img src='itmpics/$id'>

Posted (edited)

you can skip the complications, takes longer but you can just put <img src="yourimage.jpg"> or <img src="images/yourimage.jpg"> into the name field in your database so then it shows up everywhere item does. you may want to add <br> to make the spacing of name and image look better. but youll figure it out from there. you have the images in the main directory or in images folder. the <img src> just calls it out for whereevr the image shows (inventory, battle, shops etc)

Edited by Dominion
Don't post insults... removed from post
Posted

whats the old saying? keep it simple stupid. thats the point, you are forced to edit items through database if you add item pics that way. staff panel doesn't compute.

 

Items are created through the admin panel.

What you going to do hard code all your item pics into the game. Laughable.

Posted
whats the old saying? keep it simple stupid. thats the point, you are forced to edit items through database if you add item pics that way. staff panel doesn't compute.

edit the staff file so you can add pictures through it? No need to go to the database every time...

Posted

same amount of work either way. why go with a way you are having issues understanding when theres a simpler way that works.

 

edit the staff file so you can add pictures through it? No need to go to the database every time...
Posted
same amount of work either way. why go with a way you are having issues understanding when theres a simpler way that works.

Well that's fine if you find it simple, but that's not you being “forced” then is it? People do things differently.

Posted

it doesn't matter how or when you reach the top of the mountain. its how you get there.

 

Well that's fine if you find it simple, but that's not you being “forced” then is it? People do things differently.
Posted
it doesn't matter how or when you reach the top of the mountain. its how you get there.

Sometimes the scenic route is better then the direct one, and sometimes direct is needed...

It depends on the person. How you do it is down to you, the point is the staff panel does not force you to take one way as you suggested. Anyways you get the point.

Posted

Replace line 21 with this

$itmpic = "<tr style='background: gray;'><td colspan='2' style='text-align: center;'><img src='images/itmpics/".$id['itmpic']."'></td></tr>"; }

Go through line 22 and replace any double quotes with single quotes. It should be class='highlight' not "highlight"

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