PHP Order By Querying Select with MySQLi

Embedding a post directly into a query can result in numerous undesirable outcomes that can harm your web application, lead to data loss or compromise, or even worse. Thus, it is a crucial and beneficial practice to avoid. One potential solution to this issue is sorting your outcomes in descending order.


The error message indicates that the


column is missing from your


table, which is causing

order by id

to fail.

Adjust the column name to make it valid, for instance, as shown in the example below:

$query2 = "SELECT * FROM items WHERE itemownerid = '".$creatorid."' AND game = 1 AND `game_id` = $gameid ORDER BY   DESC"; 

Kindly consider the comment recommended by @tadman as it is essential and valuable.

Frequently Asked Questions

Posted in Php