Jump to content

Recommended Posts

here's what I have-
[code]
$query = mysql_query("SELECT * FROM $table WHERE mls = $MLS") or die(mysql_error());
[/code]

I'm getting the error-
[code]
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 'WHERE mls = 701555' at line 1
[/code]

What am I doing wrong?
Link to comment
https://forums.phpfreaks.com/topic/10454-problem-w-php-mysql-syntax/
Share on other sites

$query = mysql_query("SELECT * FROM $table WHERE mls = [b][!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]'[!--colorc--][/span][!--/colorc--][/b] $MLS [b][!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]'[!--colorc--][/span][!--/colorc--][/b] ") or die(mysql_error());
I changed mine to match your suggestion but I still get the error--
[code]
$query = mysql_query("SELECT * FROM $table WHERE mls = '$MLS'") or die(mysql_error());
[/code]

[code]
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 'WHERE mls = '701555'' at line 1
[/code]
That didn't give much more info--

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 'WHERE mls = '701555'' at line 1 with query

What's strange is when I type the query into SQLyog--

SELECT * FROM flex_residential WHERE mls = 701555

it returns the correct result...

I'm such an idiot, nevermind. I wasn't passing a required variable to the url to satisfy a switch I had right above this code that gives the value of $table.

Sorry for my Friday dumbness!
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.