RE: [PHP-DB] dropping one word from column entries
Naw do your parsing in PHP..try to lessen the load on the DB server any way you can... ed At 09:11 AM 5/30/2002 +0800, Beau Lebens wrote: A cleaner option might be to do this before you get it to PHP at all, via your SQL query. Check out the string functions available, there are a number of substring-style things available, string position etc. HTH Beau // -Original Message- // From: Ed Gorski [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 30 May 2002 12:09 AM // To: Jen Swofford; php-db@lists. php. net // Subject: Re: [PHP-DB] dropping one word from column entries // // // use: // // $name=Mouse Housing Products; // $name=str_replace(Products,,$name); // // also the RTFM() function works too // // ed // // At 11:06 AM 5/29/2002 -0500, Jen Swofford wrote: // I'm having a problem with this and suppose I'm looking for // a handout. :| // // I am displaying names of product categories. The names of // the categories // are: // // Bird Cages // Cat Toys // Chinchilla Housing Products // Dog Leashes // Ferret Housing Products // Mouse Housing Products // // What I want to do when displaying the names is to drop // Products whenever // it appears. What I want do display on the page instead is: // // Bird Cages // Cat Toys // Chinchilla Housing // Dog Leashes // Ferret Housing // Mouse Housing // // And no, changing the names of the categories in the // database is not an // option. :) I'm completely missing the boat on this one... // any help? // // Jen Swofford // [EMAIL PROTECTED] // // // // // -- // 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 // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] dropping one word from column entries
I'm having a problem with this and suppose I'm looking for a handout. :| I am displaying names of product categories. The names of the categories are: Bird Cages Cat Toys Chinchilla Housing Products Dog Leashes Ferret Housing Products Mouse Housing Products What I want to do when displaying the names is to drop Products whenever it appears. What I want do display on the page instead is: Bird Cages Cat Toys Chinchilla Housing Dog Leashes Ferret Housing Mouse Housing And no, changing the names of the categories in the database is not an option. :) I'm completely missing the boat on this one... any help? Jen Swofford [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] dropping one word from column entries
use: $name=Mouse Housing Products; $name=str_replace(Products,,$name); also the RTFM() function works too ed At 11:06 AM 5/29/2002 -0500, Jen Swofford wrote: I'm having a problem with this and suppose I'm looking for a handout. :| I am displaying names of product categories. The names of the categories are: Bird Cages Cat Toys Chinchilla Housing Products Dog Leashes Ferret Housing Products Mouse Housing Products What I want to do when displaying the names is to drop Products whenever it appears. What I want do display on the page instead is: Bird Cages Cat Toys Chinchilla Housing Dog Leashes Ferret Housing Mouse Housing And no, changing the names of the categories in the database is not an option. :) I'm completely missing the boat on this one... any help? Jen Swofford [EMAIL PROTECTED] -- 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] dropping one word from column entries
Ed Gorski [EMAIL PROTECTED] wrote: use: $name=Mouse Housing Products; $name=str_replace(Products,,$name); also the RTFM() function works too I'd also trim it to get rid of any extra spaces that are left: $name = trim(str_replace(Products,,$name)); -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] dropping one word from column entries
A cleaner option might be to do this before you get it to PHP at all, via your SQL query. Check out the string functions available, there are a number of substring-style things available, string position etc. HTH Beau // -Original Message- // From: Ed Gorski [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 30 May 2002 12:09 AM // To: Jen Swofford; php-db@lists. php. net // Subject: Re: [PHP-DB] dropping one word from column entries // // // use: // // $name=Mouse Housing Products; // $name=str_replace(Products,,$name); // // also the RTFM() function works too // // ed // // At 11:06 AM 5/29/2002 -0500, Jen Swofford wrote: // I'm having a problem with this and suppose I'm looking for // a handout. :| // // I am displaying names of product categories. The names of // the categories // are: // // Bird Cages // Cat Toys // Chinchilla Housing Products // Dog Leashes // Ferret Housing Products // Mouse Housing Products // // What I want to do when displaying the names is to drop // Products whenever // it appears. What I want do display on the page instead is: // // Bird Cages // Cat Toys // Chinchilla Housing // Dog Leashes // Ferret Housing // Mouse Housing // // And no, changing the names of the categories in the // database is not an // option. :) I'm completely missing the boat on this one... // any help? // // Jen Swofford // [EMAIL PROTECTED] // // // // // -- // 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 // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php