ide sytax error

Posted on 2013-01-13
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
Question by:rgb192
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
LVL 110

Expert Comment

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

Accepted Solution

Lukasz Chmielewski earned 500 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


Author Closing Comment

ID: 38772527
no syntax errors
LVL 110

Expert Comment

by:Ray Paseur
ID: 38772528
Or maybe get rid of all that fiddly punctuation by using the PHP HEREDOC notation.

$q .= <<<ENDQ
 SET $columnname
 = CONCAT($columnname, 'somthing to add to description')

Open in new window

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

730 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