Solved

ide sytax error

Posted on 2013-01-13
4
222 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 110

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

0
 

Author Closing Comment

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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