Back to the month index |
Back to the list index
|
Aaron Abelard (aarona@iquest.net)
Mon, 7 Apr 1997 10:16:53 -0500 (EST)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Oscar Santos: "Re: [mSQL] PHP/mSQL/Apache problem"
- Previous message: SAW Computer Enterprises: "[mSQL] mSQL/Perl -- How to capture query results"
- Next in thread: G.h.van den Berg: "Re: [mSQL] Lite-w3-msql question: how to delete spaces in a query?"
Date: Mon, 7 Apr 1997 10:16:53 -0500 (EST) From: Aaron Abelard <aarona@iquest.net> Subject: Re: [mSQL] Lite-w3-msql question: how to delete spaces in a query? Message-Id: <Pine.GSO.3.95q.970407101412.15228B-100000@iquest9>On Mon, 7 Apr 1997, RHS Linux User wrote:
> i mean 'delete spaces' that is ;
>
> If a variable $num contain '001 ' or ' 001' or ' 001 '
> I would like to cut off the spaces. I mean
>
> $num=' 001';
> $num=delspaces($num);
> echo $num;
>
> produces as output '001', not ' 001'. I've a form and I would like to prevent
> that who enter the number in the form don't put space. If it does and I don't
> do anithing, the search could fail :-) * sorry for my bad englidh :(*
(this is untested code)
$x = strlen($num);
$y = 0;
while($y < $x);
$a = substr($num, $y, 1);
if($a != " ");
$newnum += $a;
endif;
$y++;
endwhile;
This should leave $newnum as $num without any spaces.
-- Aaron Abelard / aarona@iquest.net IQuest Internet / www.iquest.net Indianapolis, IN / 317.259.5050.301-------------------------------------------------------------------------- To remove yourself from the Mini SQL mailing list send a message containing "unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing "info msql-list" to majordomo@bunyip.com for info on monthly archives of the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!