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
Solved

ide sytax error

Posted on 2013-01-13
4
218 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
  • 2
4 Comments
 
LVL 109

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 109

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

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 …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

839 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