Jump to content

query problem


Porl123

Recommended Posts

I've got a query that I'm trying to order by doing a sum with one of its fields and one array:

 

$sql = mysql_query("SELECT `type` FROM `items` WHERE `username` = '".$username."' ORDER BY (($items[id]['price'] / 50) * (50 - `damage`)) DESC");

 

The problem is with the: $items[id]['price']

The $items is an array although the id for the [id] is the id of the item it's currently selecting with the query, but thinking about it it's obviously just going to see that [id] as its own field, rather than the field in the database

Sorry if I'm not explaining this very well but I'm crappy with the terminology :P if anyone knows how I can get the query to to recognise it as the id field in the database could you help me? ;D thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/176081-query-problem/
Share on other sites

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.