Re: retrieving first paragraph

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Which system do you use? Which commands (How did you select the text from 
the commandline)?
It is possible that the pcre does not work because of those 'weird 
letters'. You can also try to get the ASCII-Code of this symbol and then 
use chr($ascii) in php instead of \n or \r. Maybe this works?

.ma

-----Original Message-----
From: Lisi <lists@shemeshdirectory.co.il>
To: "matthias" <grillen@abendstille.at>
Date: Tue, 27 May 2003 10:47:58 +0200
Subject: Re:  retrieving first paragraph

> I tried that, no luck. I'm using MySQL but inputting data with
> PhpMyAdmin - 
> anyone know if that would affect this? I selected the text from the 
> commandline and put it into a text file, which when I opened with my
> text 
> editor (NoteTab light) displayed the line breaks with a weird square
> before 
> the \n. I opened it in Notepad, and the square was replaced by a Hebrew
> letter. I do have Hebrew enabled on my computer, but there is no Hebrew
> displayed when using PhpMyAdmin.
> 
> I'd appreciate any thoughts on the subject, I'm at the end of my rope
> with 
> this one and I'm afraid we're getting out of the realm of PHP/MySQL.
> 
> Thanks,
> 
> -Lisi
> 
> At 09:16 AM 5/27/03 +0200, you wrote:
> >Hi!
> >
> >it is possible that your database does not return \n as a line break
> but
> >\r
> >
> >it is also possible that the linebreak contains both \r\n but i don't
> >think that this is for your case, cause it should have worked...
> >
> >first just try \r instead of \r again first with only \r and then
> again
> >with \r\r
> >
> >perhaps this solves your problem?
> >
> >.ma
> >
> >-----Original Message-----
> >From: Lisi <lists@shemeshdirectory.co.il>
> >To: heilo <grillen@abendstille.at>, PHP-DB <php-db@lists.php.net>
> >Date: Tue, 27 May 2003 09:02:25 +0200
> >Subject: Re:  retrieving first paragraph
> >
> > > I'm still getting the entire text when I echo $paragraphs[0], and
> > > $paragraphs[1] is empty (I thought the array was supposed to have
> the
> > > whole
> > > text, and then the individual selected parts). I tried with both
> \n,
> > > which
> > > was balnk, and \n'n, which returned the entire text.
> > >
> > > Any ideas why?
> > >
> > > Thanks,
> > >
> > > -Lisi
> > >
> > >
> > > At 12:02 PM 5/26/03 +0200, heilo wrote:
> > > >hi!
> > > >
> > > >afaik limiting the query may get quite complicated, using those
> > > >string-operators. in php just do it this way:
> > > >
> > > >     // depending on your $excerpt you have to use \n\n or only \n
> > > >     $paragraphs = preg_split('#([^\n]+)(\n\n)#mi', $excerpt);
> > > >     echo $paragraphs[0]; // contains first paragraph
> > > >
> > > >hope this works.
> > > >
> > > >.ma
> > > >
> > > >Lisi <lists@shemeshdirectory.co.il> wrote@26.05.2003 12:07 Uhr:
> > > >
> > > > > I have a table column that stores a few paragraphs of text. I
> want
> > > a
> > > > > preview page that retrieves the first paragraph, and then links
> to
> > > the full
> > > > > text on another page.
> > > > >
> > > > > 1) Can I limit this in the MySQL query?
> > > > >
> > > > > 2) If not, how would I select all text up until the first \n? I
> so
> > > far have
> > > > >
> > > > >   ereg("(.){1,}\n", $text, $excerpt);
> > > > >
> > > > > I want the parentheses to capture the text up until the \n in
> the
> > > variable
> > > > > $excerpt, and then stop there.
> > > > >
> > > > > How do I do this with ereg?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > -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 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux