RE: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
Actually, an easier tool to use is dos2unix, which is available on most Linux boxes. Just type dos2unix [filename], and you should be all set. - Russ Johnson Sabadell Spain -Mensaje original- De: Michael Cortes [mailto:[EMAIL PROTECTED] Enviado el: Thursday, August 19, 2004 1:36 PM Para: [EMAIL PROTECTED] Asunto: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB This may not be exaxtly PHP-DB related but it is a result of screwing something up grin. I pulled a bunch of data from a DOS formatted tab seperated file and now I am dumping back out into a text file (on linux). So, as you can imagine, I ended up with a bunch of ^M throughout the file. I plan on fixing this. The solution is easy enough. I just need to remember to open the text files in vim and save as unix files. However, I now have an immediate need. I want to open these five files in vim and find and replace the ^M in every instance. I know how to find and replace (:g/find//s/replace/g). But I cannot get the ^M in the string. If I actually hit ctrl-m it reads as a return; if I type ^M using the shift-6 then it looks for the actual characters. Can anyone help? -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Problem with script
Just looking at the error message shows why it's failing in this case: 't read card','1099413551')' at line 1 One of the fields you're trying to insert is likely 'Can't read card', and since in the query you are surrounding it with single quotes, and it's coughing on the word Can't , which has a single quote. Check out the add_slashes($str) function, which will add a backslash before the single quote, e.g., 'Can\'t read card'. That should do the trick. - Russ -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Enviado el: Tuesday, November 02, 2004 5:42 PM Para: [EMAIL PROTECTED] Asunto: [PHP-DB] Problem with script Hi all, greetings from Phoenix, Arizona! I'm having a problem with a PHP script and the database it manages. I'm having his error message: Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 't read card','1099413551')' at line 1 I don't know what is happening, usually the database works well but sometimes this strange error appears. I'm sending you the scripts in where I think the error could be. Any suggestion or comment will be very appreciated. Thanks Renato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] preg_math vs preg_match_all
For those perl fans out there, preg_match_all adds the g (global) flag to the expression. So this: preg_match('/foo/', $str, $match); would be like $str =~ /foo/; preg_match_all('/foo/', $str, $match); like $str =~ /foo/g; - Russ p.s. - anyone coming from Perl to PHP can get a little hung up on the preg_* functions... -Mensaje original- De: Gerard Samuel [mailto:[EMAIL PROTECTED] Enviado el: Tuesday, November 23, 2004 2:37 PM Para: Yemi Obembe CC: [EMAIL PROTECTED] Asunto: Re: [PHP-DB] preg_math vs preg_match_all Yemi Obembe wrote: Just want to know the difference between preg_match and preg_match_all. preg_match stops after the first match. preg_match_all gets *all* the matches. E.g. If you have a string - $str = foofoo; preg_match('/foo/', $str, $match); - $match will have an array with one foo. preg_match_all('/foo/', $str, $match); - $match will have an array with two foo. Thats basically it. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php