DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • December 11, 2018, 01:39:47 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages

Pages: [1]   Go Down
Author Topic: Clan Weapon and Armor Shops  (Read 98 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline

Posts: 491

View Profile
« on: December 03, 2018, 01:32:15 AM »

ok, I do not understand something here.  When I go into the shops, the order of weapons available does nt seem to match the sql call.  Coding below.

According to what I see, it should order the rows by "value" which is the attack/defense strength of the weapon.

But the output I get is ordered by "shopid" - meaning someone who made a much weaker weapon, later than I made a powerful weapon....my weapon is showing up first...instead of ordering it by order of lowest value to highest value.

Here is the coding - I did not alter this from the original module in any way...except biggifying the type using <big> and </big>
rawoutput("<table border=0 cellpadding=2 cellspacing=1 bgcolor='#999999'>");
    rawoutput("<tr class='trhead'>");
   $sql = "SELECT * FROM " .db_prefix("clanshop"). " WHERE type = '1' AND clan = '$clan' AND buyer < 1 AND value < '$dklimit' ORDER BY 'value'";
$res = db_query($sql);
   for ($i=0;$i<db_num_rows($res);$i++){
   $row = db_fetch_assoc($res);
     $id = $row['shopid'];
        $name = $row['name'];
     $value = $row['value'];
     $cost = $row['cost'];
       rawoutput("<tr class='".($i%2?"trlight":"trdark")."'>");
rawoutput("<td nowrap>[ <big><a href='runmodule.php?module=clanforge&op=buyweapon&id=$id'>$choose</big></a>]");
   output_notl("<td><big>`^%s</big></td>`0", $row['name'], true);
     output_notl("<td><big>`&%s`0</big></td>", $row['value'], true);
        output_notl("<td><big>`^%s`0</big></td>", $row['cost'], true);

It eve says in the SQL call, ORDER BY "value" - so why is the output ordering by "shopid" instead?
Offline Offline

Posts: 491

View Profile
« Reply #1 on: December 03, 2018, 01:43:24 AM »

Never mind.

I found my own problem.  The original coder put 'value' as is

ORDER BY 'value'

and it should be


No quotes around value, and specify ascending versus descending order.

I like to play with this stuff to learn how things work and why.

I found my own answer this time.

Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
41 Guests, 1 User
Home Forums News Downloads Login Register Advanced Search