For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > January 2005 > RE: [PHP-DB] Hyphens and MySQL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [PHP-DB] Hyphens and MySQL
Bastien Koert

2005-01-28, 3:57 pm

sure, lots of way, regex replacement, str_replace, etc

but its strange that a hyphen is causing an error.

can you post some code?

Bastien

>From: Mark Benson <markbenson@mac.com>
>To: php-db@lists.php.net
>Subject: [PHP-DB] Hyphens and MySQL
>Date: Fri, 28 Jan 2005 14:21:34 +0000
>
>I am having problems with entering data into MySQL from a PHP script. I am
>taking the data from an array generated by a CSV parsing routine. That in
>itself works great, however I have large number of data units with '-'
>characters in (hyphens) and it is causing the SQL queries to dump out with
>an error in the syntax. I can't get around it by putting a slash in front
>of them (using 'addcslashes'), it will just not at all accept them.
>Are they the 'wrong' type of slash? Is there an easy way to search and
>replace/remove characters in a string in PHP?
>
>--
>Mark Benson
>
>http://homepage.mac.com/markbenson
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com