should be easy question about gaming website

im helping a friend with his online game and i just started php, dont know a whole bunch about it. this code is from a ‘weapons’ shop.

one of the fields on his db is ID, and i want it to only display the id’s > 36 but i cant seem to figure out how to do it. here is some code…

$select = mysql_query(“select * from weps order by id”);

echo “

”;

while($lis = mysql_fetch_array($select))

{

$lis[cost]=number_format($lis[cost]);

echo “

”;

}

echo “

Weapon Name Strength Required Cost Min Dmg Max Dmg Buy?
$lis[name] $lis[str_req] $lis[cost] $lis[dmg] $lis[dmg2] <a href=step.php?lstep=wep&action=buy&id=$lis[id]>Buy
”;

Im assuming it will be somewhere in there where the code that will make it only show the items > ID 36

i hope someone can help! thanks a bunch :)

SQL queries are your friend ;)

http://dev.mysql.com/doc/refman/5.0/en/select.html

What you’re looking for is the WHERE clause of the SELECT query:

$select = mysql_query("select * from weps order by id");

Becomes:

$select = mysql_query("SELECT * FROM weps WHERE id > 36 ORDER BY id");
Sponsor our Newsletter | Privacy Policy | Terms of Service