
cdoyle
Members-
Posts
164 -
Joined
-
Last visited
Everything posted by cdoyle
-
Not sure if this helps at all, but... I have a VB board, and one of the things it does is gives users a different user title, once they reach a certain post amount. $gettitle = $DB_site->query_first("SELECT title FROM " . TABLE_PREFIX . "usertitle WHERE minposts<=$bbuserinfo[posts] ORDER BY minposts DESC LIMIT 1"); $customtext = $gettitle['title']; This function is basically the same thing I'm trying to do with the kill amounts.
-
oh geeze, that took care of the error, but still nothing displays on the page. How do I print $sql? I can do that and print the results here.
-
How do I print $sql? Since the code above seems to not be adodb, should the code on my page looks like this now? $sql = "SELECT * FROM`battle_rank` WHERE `Minimum_Wins`>='{$player->kills}' AND `Minimum_Wins`<='{$player->kills}'" $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ echo $row['Rank_Description'].'<br />'; } If so, I now get this error,when I display the page
-
Thanks, but it didn't work. I have my test player set to 46 wins, and that should give cause the 'noob' rating to appear, but it doesn't.
-
Hi, I'm having a hard time pulling in the data that I want to display on my page. Here is what I'm trying to do. I have a table named players It has a field named 'kills' (keeps total number of kills a player has) I have a battle_rank table Minimum_Wins (minimum number of kills needed to get this rank) Rank_Description (description of this rank) examples rows from rank description ID Minumum_Wins Icon_Path Rank_Description 1 150 images/smilies/killer.gif Hitman 3 1 images/smilies/noob.gif NOOB!!! 4 200 images/smilies/ninja.gif Ninja What I need to do is create a query that will display the current rank of the player. If a player has less then 150 kills he gets a 'noob' ranking If a player has 150 or more he gets 'hitman' If a player has 200 or more he gets 'ninja' and it will keep going as I update the table. I just can't seem to get the query to pull only the data I need. I've been experimenting and the best I came up with, was this. <?php $queryrank = $db->Execute("select * from `battle_rank` where '$player->kills'>=`Minimum_Wins`"); $battlerank = $queryrank->fetchrow(); echo $battlerank['Rank_Description'] . "\n<br />"; ?> but it doesn't work. I'm hoping someone with more experience writing queries can see where I'm going wrong! I know one thing I'm missing it to make sure it displays only the highest description the player has. So if he has 200 kills it doesn't retrieve both hitman and ninja rows. It needs to pull just the ninja row. Any suggestions?
-
Thank you for replying, I'm looking at the code you posted, and I'm not sure if it's what I need or not. It's my fault, think I may not have explained very well what I'm trying to do. I noticed in the query 200 is coded into it. I was just using that as example of one of the battle rank levels. In my battle rank table, I want to be able to add as many different levels and icons as I can. To give people something to work for. Right now I only have 3 rows in the battle_rank table. ID.....Min_Level.......Icon...........Description 1........0.............easy.gif......Easy Target 2........1.............Noob.gif......Noob 3........150..........hitman.gif.....hitman so as the game progresses, I want to be able to add more, and have the query look at the total battle of a player, and check their win percentage and assign the appropriate gif. So someone with 150 battles, with 60+% wins would get the hitman gif. But someone with 150 battles, with a 49% win would get easy target. Someone with 50 battles and 60% would get the noob gif. Someone with 50 battle and 48% would get easy target. I'm wondering if the PHP would even need to update the DB at all? I've calculated the total wins already, I used that to get the %win. So I'm wondering if a query can be made that looks at the total wins, and then looks at the battle rank table, and then if the % is high enough it displays the data from the appropriate row. I've attached my home.php that shows where I listed the win%.
-
Not sure if it helps, but I have a players table that holds the win/losses. Fields are ID username kills deaths
-
Hi, I've been working with a ezRPG game, and trying to modify it some to make it a little more unique. One of the things I would like to do is on the users profile page, is display their win percentage (I have this part done), and also a little icon next to their percentage. This icon that displays will depend on 2 things, the total number of battles, and their win percentage. So if they reach the min level for the next icon (for example 200 wins) they also need to keep their win percentage above 60% to get the new icon. If they don't meet the 60% they get the 'easy target' icon. So I'm trying to figure out how to do this. I believe I'll need to make a new table in my DB, that has these fields 'the minimum battles needed for each', the 'icons', and 'description of the icon'. but the part I can't figure out how to do is code the PHP to display the right icons. How would I write the query for that?
-
If anyone later on needs to know the answer, it's echo "<img src=\"" . $item['Item_Image'] . "\"/>";
-
anybody else see something I'm missing?
-
good eye! I fixed it, but it didn't make a difference. <img src="$item['Item_Image']" WIDTH="100" HEIGHT="100" BORDER="0">; the error I'm getting is line 194 the img line.
-
I must be really close, I've added the new field to $query and did the echo, and it displayed the URL. but if I do this <img scr="$item[item_Image]" WIDTH="100" HEIGHT="100" BORDER="0"> I just get an error on the page. should the code look like this? echo "<fieldset>\n"; echo "<legend><b>" . $item['name'] . "</b></legend>\n"; echo "<table width=\"100%\">\n"; echo "<tr><td width=\"85%\">"; <img scr="$item[item_Image]" WIDTH="100" HEIGHT="100" BORDER="0">; echo $item['description'] . "\n<br />"; echo "<b>Effectiveness:</b> " . $item['effectiveness'] . "\n"; echo "</td><td width=\"15%\">"; echo "<b>Price:</b> " . $item['price'] . "<br />"; echo "<a href=\"shop.php?act=buy&id=" . $item['id'] . "\">Buy</a><br />"; echo "</td></tr>\n"; echo "</table>"; echo "</fieldset>\n<br />";
-
I'm trying to modify some code from an existing PHP page. which I believe has the row detail in it. if ($query->recordcount() == 0) { echo "No items found! Try changing your search criteria."; } else { while ($item = $query->fetchrow()) { echo "<fieldset>\n"; echo "<legend><b>" . $item['name'] . "</b></legend>\n"; echo "<table width=\"100%\">\n"; echo "<tr><td width=\"85%\">"; echo $item['description'] . "\n<br />"; echo "<b>Effectiveness:</b> " . $item['effectiveness'] . "\n"; echo "</td><td width=\"15%\">"; echo "<b>Price:</b> " . $item['price'] . "<br />"; echo "<a href=\"shop.php?act=buy&id=" . $item['id'] . "\">Buy</a><br />"; echo "</td></tr>\n"; echo "</table>"; echo "</fieldset>\n<br />"; What I would like is to display the image right in front of the description.
-
Hi, I've been searching the forum, but haven't found the answer to this. I have a feeling it will be an easy one. On my webserver, I created a new directory called images On my mysql database I created a new column called 'item_images' where I listed the URL path to the image needed for that record. On my PHP page, what is the code to display the image? Is it something like this? IMG SRC="<?php echo $Item_Image.'.jpg'; ?>" WIDTH="100" HEIGHT="100" BORDER="0">