RE: [PHP] MySQL Problem with PHP
| From: | John Holmes | Date: | Wed, 26 Jun 2002 13:25:47 +0000 |
| Subject: | RE: [PHP] MySQL Problem with PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103961@lists.php.net to get a copy of this message | ||
> INSERT INTO
contracts (key,
> content) VALUES (1,'blah blah blah
> character 39 is a single speach mark '+CHAR(39)+' blah blah blah')
That's because you are adding strings together, not concatenating them
(this isn't javascript!)
Use CONCAT() in MySQL to join strings together.
mysql> select 'this'+char(39)+'that';
+------------------------+
| 'this'+char(39)+'that' |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.03 sec)
mysql> select concat('this',char(39),'that');
+--------------------------------+
| concat('this',char(39),'that') |
+--------------------------------+
| this'that |
+--------------------------------+
1 row in set (0.01 sec)
---John Holmes...