Hello brows,I'd like a little help.

I'm making a web online game,then in the Map system.

I need get coords of players that is around.

Get in Database something like that:

<?php
$result = mysql_query("select * from mapa where x_coord > '5' AND x_coord < '10'");
while($row = mysql_fetch_array($result)) {
?>

But dosen't work cuz don't accept the ">" OR "<".

I know,I'd can create a

IF($row['x_coord'] > 5 OR $row['x_coord'] < 10) {

But if there's many players,it would give a sucking LAG =/

Someone have another idea?Thanks =)

Recommended Answers

All 2 Replies

Have you tried running the select statement directly in your database to see if you get an error at database level (always my first point of testing)?

Member Avatar for diafol

I'm a bit confused as to why you want to use OR in this case as it would return all records. AND seems to be the most appropriate operator. You can also try the BETWEEN keyword. If your data is integer, you don't need the single quotes in the SQL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.