|
Posted by klenwell on 09/28/07 22:01
On Sep 28, 1:51 pm, GarryJones <mor...@algonet.se> wrote:
> > What do you want to do with the invalid values?
>
> You answer made great sense and I thank both of you for the time you
> have spent on my problem.
>
> Yes, I set up the database last year totally incorrectly, something I
> am hoping to fix now I am a little more experienced.
>
> For instance, a field in table_2007 can have the value 15 303 stored
> as varchar. I want php to create a variable to the form with the
> proposed value 15303. Then when the user presses ok, this value (or a
> new one if the user so chooses) will be inserted in table_2008 (INT
> UNSIGNED). Therefore I need code (poss a function similar to the one I
> was trying to use) which removes the blank between 15 and 303 when the
> variable that proposes the value is executed.
>
> I feel I have learnt masses today, much obliged.
>
> Garry Jones
> Sweden
> Therefore I need code (poss a function similar to the one I
> was trying to use) which removes the blank between 15 and 303 when the
> variable that proposes the value is executed.
This should do for the simple case you describe:
http://www.php.net/manual/en/function.str-replace.php
If you expect more complex patterns, use:
http://www.php.net/manual/en/function.preg-replace.php
Tom
Navigation:
[Reply to this message]
|