Current location: Hot Scripts Forums » Programming Languages » PHP » Php syntax error


Php syntax error

Reply
  #1 (permalink)  
Old 11-15-11, 07:40 AM
bud144 bud144 is offline
New Member
 
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Php syntax error

Hi,
This is the error message i receive:
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 '' at line 1

A question before I post any of my code:
This code has been working fine until I moved from one server to another, does anyone know any reason why there should be an error like this after transferring to a different server?
any help appreciated
Bud
Reply With Quote
  #2 (permalink)  
Old 11-16-11, 01:21 AM
phplabs phplabs is offline
Newbie Coder
 
Join Date: Oct 2011
Posts: 37
Thanks: 0
Thanked 7 Times in 7 Posts
could be a different magic quotes setting. check if your quotes (and other special symbols) are escaped in the new server.
__________________
blog.phplabs.net
Reply With Quote
  #3 (permalink)  
Old 11-17-11, 08:24 AM
bud144 bud144 is offline
New Member
 
Join Date: Nov 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Magic quotes is set to on
Is there another way to test if magic quotes is causing the problem?
Reply With Quote
  #4 (permalink)  
Old 11-17-11, 02:29 PM
phplabs phplabs is offline
Newbie Coder
 
Join Date: Oct 2011
Posts: 37
Thanks: 0
Thanked 7 Times in 7 Posts
Quote:
Originally Posted by bud144 View Post
Magic quotes is set to on
Is there another way to test if magic quotes is causing the problem?
print the SQL query to screen before executing it and see if it contains any unnecessary quotes. if not quotes, perhaps you'll notice some other errors - such as missing variables, etc. perhaps the global variables ($_GET, $_POST, etc) are working in a different way on a new server and that's causing problems.
__________________
blog.phplabs.net
Reply With Quote
  #5 (permalink)  
Old 11-21-11, 05:09 PM
exoticious's Avatar
exoticious exoticious is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Magic quotes is set to on
Is there another way to test if magic quotes is causing the problem?
Reply With Quote
  #6 (permalink)  
Old 11-21-11, 11:07 PM
kfurlong's Avatar
kfurlong kfurlong is offline
Wannabe Coder
 
Join Date: Oct 2010
Posts: 150
Thanks: 6
Thanked 20 Times in 20 Posts
Quote:
Originally Posted by exoticious View Post
Magic quotes is set to on
Is there another way to test if magic quotes is causing the problem?
Turn it off and then check to see if it works. If it does then it was causing the problem. If not then you can set it back

PHP: Magic Quotes - Manual
Reply With Quote
  #7 (permalink)  
Old 11-23-11, 02:26 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Magic Quotes is a deprecated feature. If you still have it enabled, you should probably upgrade PHP.

Instead, you should use mysql_real_escape_string() for database input. That's a lot more secure, and should avoid errors like this.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error. operation error jayhighway Visual Basic 2 10-01-11 06:04 AM
Help! Parse error: syntax error, unexpected T_STRING Dealideal PHP 2 02-10-10 09:21 AM
Problem: PHP Parse error: syntax error, unexpected T_STRING joerg_jb PHP 3 07-29-09 01:46 PM
Sites Down Because Of Same Parse error: syntax error, Tony S. PHP 8 07-24-09 05:55 PM
[Newbies]Parse error: syntax error, unexpected '(', expecting T_STRING pakdoz PHP 4 10-23-07 02:07 PM


All times are GMT -5. The time now is 08:54 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.