$new_php_self = substr($PHP_SELF, 1); Does this has anything to do with db?? ----- Original Message ----- From: "lisi" <php-db@xxxxxxxxxxxxxxxxxxxxxx> To: "PHP-DB" <php-db@xxxxxxxxxxxxx> Sent: Monday, January 19, 2004 10:21 AM Subject: replacing once with ereg_replace > I have a problem with two possible solutions, I'm just not sure how to do > either one. > > I have a number of pages and their links stored in a MySQL db. The links > are stored without the leading slash (i.e. animals/birds/birds.htm). > $PHP_SELF returns the link with the leading slash (i.e. > /animals/birds/birds.htm). > > I need these two strings to match. There are two ways to do this: > > 1) Solution: Remove the leading slash from $PHP_SELF > Problem: How do remove only the first instance of the slash with > ereg-replace and leave the others? Or is there another function that would > do this? This may be obvious but I didn't see it in the documentation. > > 2) Solution: Add the leading slash to each entry in the db (MySQL) > Problem: How do I do this with a query without having to change each > one manually? I know I can change the link field using UPDATE but how would > I tell MySQL to change the entry to / + entry? Each entry is obviously > different. Using a plus makes MySQL think it's mathematical addition and > sets the field to 0. The field type is varchar. > > Thanks in advance for any suggestions! > > -Lisi > > -- > 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