[PHP-DB] Replacing subtring within table record

2004-11-15 Thread ioannes
I want to replace one substring with another within a MySQL table record, eg 
a blob.

Do I need to extract the record and do it in php or can I do it directly 
with mysql?  The Replace Syntax notes in mysql.com seem to relate to 
replacing the whole row and I'm not quite confident with shell commands.

John 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] replacing dynamic variable in preg_replace

2004-09-15 Thread Steve Morgan
I am working on a script which takes a list of variables form a 
database. The problem i am currently having is some of the variables 
have other variables in the content , i.e. $temp=h1$title/h1 (made 
up example), is something that might come out of the mysql.

   $query=mysql_query(SELECT `code`,`varname` FROM `k_sys`);
  
   while(list($code,$var)=mysql_fetch_array($query)){
   $code=str_replace(-user-,USER,$code);
   $code=preg_replace(/--(\w+)--/,$$1,$code); // PROBLEM
   $$var=$code;
   }

is the current code, i'm setting off variables with a --, so if 
variables $title, is in the mysql, the above example would be 
h1--title--/h1 instead. When i do the above i would just get like 
$title as an output. I think its due to how mysql is storing the 
information, but a stripslashes didnt work. If anyone can help it'd be 
much appreciated.

Steve Mo'gan
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] replacing dynamic variable in preg_replace

2004-09-15 Thread John Holmes
Steve Morgan wrote:
I am working on a script which takes a list of variables form a 
database. The problem i am currently having is some of the variables 
have other variables in the content , i.e. $temp=h1$title/h1 (made 
up example), is something that might come out of the mysql.

   $query=mysql_query(SELECT `code`,`varname` FROM `k_sys`);
 while(list($code,$var)=mysql_fetch_array($query)){
   $code=str_replace(-user-,USER,$code);
   $code=preg_replace(/--(\w+)--/,$$1,$code); // PROBLEM
   $$var=$code;
   }
is the current code, i'm setting off variables with a --, so if 
variables $title, is in the mysql, the above example would be 
h1--title--/h1 instead. When i do the above i would just get like 
$title as an output. I think its due to how mysql is storing the 
information, but a stripslashes didnt work. If anyone can help it'd be 
much appreciated.
preg_replace('/--(\w+)--/e','$$1',$code);
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] replacing once with ereg_replace

2004-01-19 Thread lisi
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


Re: [PHP-DB] replacing once with ereg_replace

2004-01-19 Thread Ricardo Lopes
$new_php_self = substr($PHP_SELF, 1);

Does this has anything to do with db??

- Original Message -
From: lisi [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Monday, January 19, 2004 10:21 AM
Subject: [PHP-DB] 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



[PHP-DB] Replacing + with question

2003-09-30 Thread Graeme McLaren
Hi all I want the contents of a variable to be returned to the user without
the + symbols, how do I do that?

This is what I have so far by the string replace function doesn't replace
the spaces and display bla bla bla as I want:

$AddressLine1 = urlencode($AddressLine1);
$AddressLine1 = str_replace( , +, $AddressLine1);
echo First Line Of Address: BR input type=text Name=AddressLine1
value=$AddressLine1BRBR;



Cheers,

Graeme :)

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Replacing + with question

2003-09-30 Thread Jason Wong
On Wednesday 01 October 2003 01:06, Graeme McLaren wrote:

 This is what I have so far by the string replace function doesn't replace
 the spaces and display bla bla bla as I want:

Probably it's because you're trying to replace spaces with +. Swap your first 
2 parameters.

 $AddressLine1 = urlencode($AddressLine1);
 $AddressLine1 = str_replace( , +, $AddressLine1);

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Surprise your boss.  Get to work on time.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Replacing + with question

2003-09-30 Thread Graeme McLaren
Jason, thank you for reply.  I tried switching the 1st 2 parameters in the
str_replace function so that it now looks like this:

$AddressLine1 = urlencode($AddressLine1);

$AddressLine1 = str_replace(+,  , $AddressLine1);



Unfortunately as I am now replacing the + symbols with a space   only the
part up to the first space is displayed back to the user.

Any ideas?

Cheers again,

Graeme :)

- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 30, 2003 7:12 PM
Subject: Re: [PHP-DB] Replacing + with   question


 On Wednesday 01 October 2003 01:06, Graeme McLaren wrote:

  This is what I have so far by the string replace function doesn't
replace
  the spaces and display bla bla bla as I want:

 Probably it's because you're trying to replace spaces with +. Swap your
first
 2 parameters.

  $AddressLine1 = urlencode($AddressLine1);
  $AddressLine1 = str_replace( , +, $AddressLine1);

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-db
 --
 /*
 Surprise your boss.  Get to work on time.
 */

 -- 
 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] Replacing + with question

2003-09-30 Thread CPT John W. Holmes
From: Graeme McLaren [EMAIL PROTECTED]

 Jason, thank you for reply.  I tried switching the 1st 2 parameters in the
 str_replace function so that it now looks like this:

 $AddressLine1 = urlencode($AddressLine1);

 $AddressLine1 = str_replace(+,  , $AddressLine1);



 Unfortunately as I am now replacing the + symbols with a space   only
the
 part up to the first space is displayed back to the user.

 Any ideas?

I think this whole problem can be solved by putting quotes around your HTML
values.

echo First Line Of Address: BR input type=\text\ Name=\AddressLine1\
value=\$AddressLine1\BRBR;

Now, the ONLY thing you need to do to $AddressLine1 to make it safe to
insert into this HTML form element is run htmlentities() on it.

$safe_AddressLine1 = htmlentities($AddressLine1);
echo First Line Of Address: BR input type=\text\ Name=\AddressLine1\
value=\$safe_AddressLine1\BRBR;

I think the whole bit with + and spaces will go away if you do this.
Remember that you may see this+that in the URL, but it's decoded
automatically when it gets to your PHP script back to this that...

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Replacing * with %

2002-01-15 Thread Markus Lervik

Hello all!

I can't for the love of god get neither ereg_replace nor str_replace
to work. I wan't to replace * with % so I can use SELECT ... WHERE
whatever LIKE string% in MySQL.

I've tried ereg_replace(*,%,$search_name). Didn't work.
I tried escaping the asterisk. I tried double-escaping the asterisk.
I  tried str_replace(*,%,$search_name), and that didn't work
either. I tried just about everything I could think of, escaping, double-
escaping and triple-escaping ad nauseum, but it just wont work.

Oh, yes, I also tried $search_name=ereg_replace(blablabla);
What a surprise. It didn't work.

Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net
and just about everything in between.

Pretty soon I'll start bashing away on that Solaris 8 box over there.


Markus - frustrated

-- 
Markus Lervik
Linux-administrator with a kungfoo grip
Vaasa City Library - Regional Library
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Replacing * with %

2002-01-15 Thread matt stewart

/* sorry markus, forgot to post this to the list, so here it is again! */


don't know if this is the solution without doing some reading, so i'll tell
you what i think it might be and you can read up on it!
is either (or both?) * and % special characters in regular expressions? if
so, it may be possible to delimit them with slashes, that would be my
thinking anyway.
Let me know if i'm right or (more likely) wrong!
cheers,

Matt

-Original Message-
From: Markus Lervik [mailto:[EMAIL PROTECTED]]
Sent: 15 January 2002 09:40
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Replacing * with %


Hello all!

I can't for the love of god get neither ereg_replace nor str_replace
to work. I wan't to replace * with % so I can use SELECT ... WHERE
whatever LIKE string% in MySQL.

I've tried ereg_replace(*,%,$search_name). Didn't work.
I tried escaping the asterisk. I tried double-escaping the asterisk.
I  tried str_replace(*,%,$search_name), and that didn't work
either. I tried just about everything I could think of, escaping, double-
escaping and triple-escaping ad nauseum, but it just wont work.

Oh, yes, I also tried $search_name=ereg_replace(blablabla);
What a surprise. It didn't work.

Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net
and just about everything in between.

Pretty soon I'll start bashing away on that Solaris 8 box over there.


Markus - frustrated

-- 
Markus Lervik
Linux-administrator with a kungfoo grip
Vaasa City Library - Regional Library
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Replacing * with %

2002-01-15 Thread matt stewart

just checked it out, and * is a special character unless enclosed in class
brackets.
so using [*] should hopefully work!
give it a go and see.
cheers,
  Matt

-Original Message-
From: matt stewart [mailto:[EMAIL PROTECTED]]
Sent: 15 January 2002 09:54
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Replacing * with %


/* sorry markus, forgot to post this to the list, so here it is again! */


don't know if this is the solution without doing some reading, so i'll tell
you what i think it might be and you can read up on it!
is either (or both?) * and % special characters in regular expressions? if
so, it may be possible to delimit them with slashes, that would be my
thinking anyway.
Let me know if i'm right or (more likely) wrong!
cheers,

Matt

-Original Message-
From: Markus Lervik [mailto:[EMAIL PROTECTED]]
Sent: 15 January 2002 09:40
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Replacing * with %


Hello all!

I can't for the love of god get neither ereg_replace nor str_replace
to work. I wan't to replace * with % so I can use SELECT ... WHERE
whatever LIKE string% in MySQL.

I've tried ereg_replace(*,%,$search_name). Didn't work.
I tried escaping the asterisk. I tried double-escaping the asterisk.
I  tried str_replace(*,%,$search_name), and that didn't work
either. I tried just about everything I could think of, escaping, double-
escaping and triple-escaping ad nauseum, but it just wont work.

Oh, yes, I also tried $search_name=ereg_replace(blablabla);
What a surprise. It didn't work.

Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net
and just about everything in between.

Pretty soon I'll start bashing away on that Solaris 8 box over there.


Markus - frustrated

-- 
Markus Lervik
Linux-administrator with a kungfoo grip
Vaasa City Library - Regional Library
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Replacing * with %

2002-01-15 Thread Rosser, Chris

The following works fine for me:

$currentword = ereg_replace(\*,%,$currentword);

Chris
}:)

 -Original Message-
 From: matt stewart [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 15, 2002 9:57 AM
 To:   [EMAIL PROTECTED]
 Subject:  RE: [PHP-DB] Replacing * with %
 
 just checked it out, and * is a special character unless enclosed in class
 brackets.
 so using [*] should hopefully work!
 give it a go and see.
 cheers,
   Matt
 
 -Original Message-
 From: matt stewart [mailto:[EMAIL PROTECTED]]
 Sent: 15 January 2002 09:54
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Replacing * with %
 
 
 /* sorry markus, forgot to post this to the list, so here it is again! */
 
 
 don't know if this is the solution without doing some reading, so i'll
 tell
 you what i think it might be and you can read up on it!
 is either (or both?) * and % special characters in regular expressions? if
 so, it may be possible to delimit them with slashes, that would be my
 thinking anyway.
 Let me know if i'm right or (more likely) wrong!
 cheers,
 
 Matt
 
 -Original Message-
 From: Markus Lervik [mailto:[EMAIL PROTECTED]]
 Sent: 15 January 2002 09:40
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Replacing * with %
 
 
 Hello all!
 
 I can't for the love of god get neither ereg_replace nor str_replace
 to work. I wan't to replace * with % so I can use SELECT ... WHERE
 whatever LIKE string% in MySQL.
 
 I've tried ereg_replace(*,%,$search_name). Didn't work.
 I tried escaping the asterisk. I tried double-escaping the asterisk.
 I  tried str_replace(*,%,$search_name), and that didn't work
 either. I tried just about everything I could think of, escaping, double-
 escaping and triple-escaping ad nauseum, but it just wont work.
 
 Oh, yes, I also tried $search_name=ereg_replace(blablabla);
 What a surprise. It didn't work.
 
 Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net
 and just about everything in between.
 
 Pretty soon I'll start bashing away on that Solaris 8 box over there.
 
 
 Markus - frustrated
 
 -- 
 Markus Lervik
 Linux-administrator with a kungfoo grip
 Vaasa City Library - Regional Library
 [EMAIL PROTECTED]
 +358-6-325 3589 / +358-40-832 6709
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Replacing * with %

2002-01-15 Thread matt stewart

excellent! two ways to do it - Markus confirmed that [*] works too - so
don't know which is better, but we have two solutions anyway.

-Original Message-
From: Rosser, Chris [mailto:[EMAIL PROTECTED]]
Sent: 15 January 2002 10:54
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Replacing * with %


The following works fine for me:

$currentword = ereg_replace(\*,%,$currentword);

Chris
}:)

 -Original Message-
 From: matt stewart [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 15, 2002 9:57 AM
 To:   [EMAIL PROTECTED]
 Subject:  RE: [PHP-DB] Replacing * with %
 
 just checked it out, and * is a special character unless enclosed in class
 brackets.
 so using [*] should hopefully work!
 give it a go and see.
 cheers,
   Matt
 
 -Original Message-
 From: matt stewart [mailto:[EMAIL PROTECTED]]
 Sent: 15 January 2002 09:54
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Replacing * with %
 
 
 /* sorry markus, forgot to post this to the list, so here it is again! */
 
 
 don't know if this is the solution without doing some reading, so i'll
 tell
 you what i think it might be and you can read up on it!
 is either (or both?) * and % special characters in regular expressions? if
 so, it may be possible to delimit them with slashes, that would be my
 thinking anyway.
 Let me know if i'm right or (more likely) wrong!
 cheers,
 
 Matt
 
 -Original Message-
 From: Markus Lervik [mailto:[EMAIL PROTECTED]]
 Sent: 15 January 2002 09:40
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Replacing * with %
 
 
 Hello all!
 
 I can't for the love of god get neither ereg_replace nor str_replace
 to work. I wan't to replace * with % so I can use SELECT ... WHERE
 whatever LIKE string% in MySQL.
 
 I've tried ereg_replace(*,%,$search_name). Didn't work.
 I tried escaping the asterisk. I tried double-escaping the asterisk.
 I  tried str_replace(*,%,$search_name), and that didn't work
 either. I tried just about everything I could think of, escaping, double-
 escaping and triple-escaping ad nauseum, but it just wont work.
 
 Oh, yes, I also tried $search_name=ereg_replace(blablabla);
 What a surprise. It didn't work.
 
 Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net
 and just about everything in between.
 
 Pretty soon I'll start bashing away on that Solaris 8 box over there.
 
 
 Markus - frustrated
 
 -- 
 Markus Lervik
 Linux-administrator with a kungfoo grip
 Vaasa City Library - Regional Library
 [EMAIL PROTECTED]
 +358-6-325 3589 / +358-40-832 6709
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Replacing * with %

2002-01-15 Thread Bruno Gimenes Pereti

Hi Markus,

I think you forgot to assign the value of ereg_replace to a variable. I made
this test and it worked:

?
$t = 'abc*cde*';
printf(%s\n, ereg_replace(\*, \%, $t));   // or $result =
ereg_replace(\*, \%, $t);
?

Hope it helps,

Bruno Pereti.

- Original Message -
From: Markus Lervik [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 15, 2002 7:40 AM
Subject: [PHP-DB] Replacing * with %


 Hello all!

 I can't for the love of god get neither ereg_replace nor str_replace
 to work. I wan't to replace * with % so I can use SELECT ... WHERE
 whatever LIKE string% in MySQL.

 I've tried ereg_replace(*,%,$search_name). Didn't work.
 I tried escaping the asterisk. I tried double-escaping the asterisk.
 I  tried str_replace(*,%,$search_name), and that didn't work
 either. I tried just about everything I could think of, escaping, double-
 escaping and triple-escaping ad nauseum, but it just wont work.

 Oh, yes, I also tried $search_name=ereg_replace(blablabla);
 What a surprise. It didn't work.

 Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net
 and just about everything in between.

 Pretty soon I'll start bashing away on that Solaris 8 box over there.


 Markus - frustrated

 --
 Markus Lervik
 Linux-administrator with a kungfoo grip
 Vaasa City Library - Regional Library
 [EMAIL PROTECTED]
 +358-6-325 3589 / +358-40-832 6709

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]