RE: [PHP-DB] check string contens
| From: | Wesley Choate | Date: | Tue, 27 Jun 2000 15:56:53 +0000 |
| Subject: | RE: [PHP-DB] check string contens | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-665@lists.php.net to get a copy of this message | ||
Instead of using the <= in your if statment, try using if($binchk). The
only time this will be false is when $binchk is equal to zero, which will
only happen if $test is = "http://". Also, when you do your
strtolower(trim(...) you assign that result to the variable test. This is
the variable you need in your strcmp($webpage, $mask) needs to by
strcmp($test, $mask). Hope that helps you..
Wesley Choate
> -----Original Message-----
> From: Eelco de Graaff [SMTP:eelco@tri-angle.demon.nl]
> Sent: Tuesday, June 27, 2000 10:50 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] check string contens
>
> What am i dooing wrong. I want to check for the string http://
> in a
> datafield and if it is there do nothing and if it is not there add it.
>
> $mask="http://";
> $test=strtolower(trim(substr($webpage,0,7)));
> $binchk=strcmp($webpage,$mask);
> if ($binchk<=1){
> $webpage=$mask.$webpage;
> }
> # ** end
>
> Thanks ...
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>