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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.