Jump to content

[SOLVED] Help with syntax error


EchoFool

Recommended Posts

Im not sure how the structure is meant to be but im getting a syntax error with my attempt.

 

The idea is to check that something is "not greater than" a value and also "not less than" a value.. but i cannot get it to work..

 

This is what i have:

 

<?php
$Get = mysql_query("SELECT ID FROM users WHERE (ID='0' OR ID='$ID') AND ItemID='0' AND
Place='$Place' AND (ItemLevel !> ({$_SESSION['Level']}+5) OR ItemLevel !< ({$_SESSION['Level']}-5)) RAND() Limit 1")
Or die(mysql_error());
?>

 

This is my error:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '!> (4+5) OR ItemLevel !< (4-5)) RAND() Limit 1' at line 1

 

I'm assuming the !> and !< is incorrect for this... if so what is the correct syntax?

Link to comment
https://forums.phpfreaks.com/topic/116890-solved-help-with-syntax-error/
Share on other sites

What exactly are you trying to acomplish by doing !> or !<? If you are trying to accomplish not greater than or not less than you could just flip the sign and remove the !.

 

For example not greater than (!>) would obviously be anything less than, so <= would suffice. Anything less than or equal to is technically not greater than

 

The same goes for the opposite.

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.