Table Search

Discussion in 'PHP' started by gayaneducation, Dec 14, 2008.

  1. #1
    I need php function for search data(text) inside a html table. not a my sql table.

    ex: inside a table "<table><tr><td>******</td></tr></table>" i have several text. i need php function to search one of the text.

    please help to solve this issue
     
    gayaneducation, Dec 14, 2008 IP
  2. SeanBlue

    SeanBlue Peon

    Messages:
    110
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would want to use a regexp with preg_match or preg_match_all or something similar.

    Something like: '/\<table\>\<tr\>\<td\>(.+)\<\/td\>\<\/tr\>\<\/table\>/'

    In your example this would return the asterisks: ******.
     
    SeanBlue, Dec 15, 2008 IP
  3. misbah

    misbah Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    68
    #3
    search data or get data...
    and what happen after your found your text.
     
    misbah, Dec 15, 2008 IP
  4. gayaneducation

    gayaneducation Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I need php function for search data(text) inside a html table. not a my sql table.

    ex: inside a table "<table><tr><td>some text here</td></tr></table>" i have several text. i need php function to search one of the text and assign to the php variable with the position where the word is.

    or can u pls suggest the way of finding the text in a hrml table.

    please help to solve this issue
     
    gayaneducation, Dec 16, 2008 IP
  5. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #5
    use strpos() for position and preg_match for content inside it. Combine those two and you should be fine.
     
    Kaizoku, Dec 16, 2008 IP
  6. Yesideez

    Yesideez Peon

    Messages:
    196
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Maybe also run strip_tags() on it beforehand to remove HTML to make the searching easier.
     
    Yesideez, Dec 16, 2008 IP