On Tuesday 19 November 2002 03:37, John Taylor-Johnston wrote:
> Like I have a clue :)
>
> I want to convert some fields from TEXT to VARCHAR(255).
> (Going from a textarea to an input type=text)
> I've checked the length of each $mydata->ST, so I won't be losing data.
> What I am worried about is losing data if there are \n in any of the
> fields.
>
> How do I check to see if a \n exists in $mydata->ST in my WHILE statement?
>
> $sql = 'SELECT id,ST FROM ccl.ccl_main';
> ...
> $news = mysql_query($sql);
>  while ($mydata = mysql_fetch_object($news))
>       {
> if ???????$mydata->ST?????????
>   echo "$mydata->id  -  $mydata->ST<hr>";
>  }

Use strstr() with "\n" as the needle. Check out the "String functions" 
chapter, lots more goodies there.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
To program is to be.
*/


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

Reply via email to