RE: [PHP-DB] Simple field replace...?
I guess there is no other solution just do it one at a time... it's no problem even if there are 100's. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: donderdag 28 augustus 2003 11:35 To: [EMAIL PROTECTED] Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP-DB] Simple field replace...?
hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Simple field replace...?
Try using the substring function in your sql statement Substring('String',32); Jack -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Simple field replace...?
Sorry, I'll specify... I have one column, in a row of perhaps 4 fields. I want to remove the first 32 characters from onlt one field EG: My DB: namedateurl ip bob 1/2/99 http:// 1.1.1.1. sue 4/6/01 http:// 2.2.2.2 If I wanted to remove just the http bit and leave :// I'd have to remove the first 4 characters from all the 'url' column. this is what I wanna do, jsut 100+ times over. but the first 32 characters. Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:04 To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Simple field replace...? hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP-DB] Simple field replace...?
Then a simple substring will do: UPDATE mytable SET url = SUBSTRING( url FROM 5 ) btw your date column looks pretty awful. HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 12:06 PM Subject: Re: [PHP-DB] Simple field replace...? Sorry, I'll specify... I have one column, in a row of perhaps 4 fields. I want to remove the first 32 characters from onlt one field EG: My DB: namedateurl ip bob 1/2/99 http:// 1.1.1.1. sue 4/6/01 http:// 2.2.2.2 If I wanted to remove just the http bit and leave :// I'd have to remove the first 4 characters from all the 'url' column. this is what I wanna do, jsut 100+ times over. but the first 32 characters. Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:04 To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Simple field replace...? hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Simple field replace...?
like Jacob said, use the string functions of mysql in the actual SQL statment, not php. http://www.mysql.com/doc/en/String_functions.html UPDATE TABLE SET FIELD = SUBSTRING(FIELD,33) 33 as you will want to delete the 32'nd char -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 28 August 2003 11:07 To: Ignatius Reilly Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Simple field replace...? Sorry, I'll specify... I have one column, in a row of perhaps 4 fields. I want to remove the first 32 characters from onlt one field EG: My DB: namedateurl ip bob 1/2/99 http:// 1.1.1.1. sue 4/6/01 http:// 2.2.2.2 If I wanted to remove just the http bit and leave :// I'd have to remove the first 4 characters from all the 'url' column. this is what I wanna do, jsut 100+ times over. but the first 32 characters. Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:04 To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Simple field replace...? hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Simple field replace...?
Was just an examle date column ;-) Anyhoo, jsut a note to say, it's sorted..(I did the mass replace by hand :-( but at least it's done... I've also sorted anotehr prob too, so all in all, a productive morning... I jsut wish I could remember all this stuff for next time! Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:29 To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject:Re: [PHP-DB] Simple field replace...? Then a simple substring will do: UPDATE mytable SET url = SUBSTRING( url FROM 5 ) btw your date column looks pretty awful. HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 12:06 PM Subject: Re: [PHP-DB] Simple field replace...? Sorry, I'll specify... I have one column, in a row of perhaps 4 fields. I want to remove the first 32 characters from onlt one field EG: My DB: namedateurl ip bob 1/2/99 http:// 1.1.1.1. sue 4/6/01 http:// 2.2.2.2 If I wanted to remove just the http bit and leave :// I'd have to remove the first 4 characters from all the 'url' column. this is what I wanna do, jsut 100+ times over. but the first 32 characters. Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:04 To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Simple field replace...? hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***