Re: Query or solution pls..

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

 



Prathap kumar wrote:

> Hello everyone, I am trying to make "table of content" to my content in the web page.The content in the database table field look like this.
> 
> Heading 
> ..........
> ..........
> <h3>1. sub heading</h3>
> .............
> .............
> <h3>2. sub heading</h3>
> .............
> .............
> 
> Format of Table of Content Box/table with hyperlinks 
> 1. sub heading 1
> 2. sub heading 2
> 
> My question is how can I get only sub headings which are in between "<h3>.....</h3>" in the database field. Is it possible with "select query" or preg_replace_callback,,

This should do it.

<?php

// store data from database field here
$data = '';

preg_match_all('/<h3>(.*)<\/h3>/Ui', $data, $matches);

foreach ($matches[1] as $val) {
     echo $val . "\n";
}

?>


-- 
Rajesh


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux