Solved

ide sytax error

Posted on 2013-01-13
4
212 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 108

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 108

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

707 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now