Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ide sytax error

Posted on 2013-01-13
4
Medium Priority
?
225 Views
Last Modified: 2013-01-13
$q.=' ON DUPLICATE KEY UPDATE '.$tablename.' set '.$columnname.'=concat ('.$columnname.',\''.mysql_real_escape_string($_POST[$insertcolumnname]).'\');';
        
        $q.=' ON DUPLICATE KEY UPDATE '.$tablename.' set '.$columnname.'=concat ('.$columnname.',\''somthing to add to description'\')';

Open in new window


using an ide that highlights syntax errors

the first line has no errors
but the second line highlights error at
somthing
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38772211
Yes, it contains a PHP parse error.  What is the question?
0
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 2000 total points
ID: 38772467
Should be:
$q.=' ON DUPLICATE KEY UPDATE '.$tablename.' set '.$columnname.'=concat ('.$columnname.',\'somthing to add to description\')';

Open in new window

0
 

Author Closing Comment

by:rgb192
ID: 38772527
no syntax errors
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38772528
Or maybe get rid of all that fiddly punctuation by using the PHP HEREDOC notation.
http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

$q .= <<<ENDQ
 ON DUPLICATE KEY UPDATE $tablename 
 SET $columnname
 = CONCAT($columnname, 'somthing to add to description')
ENDQ;

Open in new window

You can get variable substitution with HEREDOC or literal strings with NOWDOC
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question