hi guys ,, i want all th and corresponding td value
like Beds=>7 , Baths=>8 , House Size=>12000 sq ft

<table cellspacing="0" class='abc'>
      <td>7 bed </td>
      <td>8.5 bath </td>
      <th>House Size</th>
      <td>12000 sq ft </td>
      <th>Lot Size</th>
      <td>2.62                        Acres </td>


i want to fetch those recodes and insert into mysql.

While I don't really understand why you got down voted, I will make an assumption it has to do with the lack of effort on your part.

If I was going to approach this, I would probably be looking at the php DOM extension (http://www.php.net/manual/en/book.dom.php).

Using an xPath query (http://www.php.net/manual/en/class.domxpath.php) to return all of my rows <tr></tr>

Then iterate over the collection of rows and checking if each elements nodeName (http://www.php.net/manual/en/class.domnode.php) property is equal to 'th'. If it is I would capture the nodeValue into an array. e.g. $attributes[$element->nodeValue].

Then to get it's value I would use the DOMNode::nextSibling property to get the next adjacent node which should be a td, so check its nodeName is equal to 'td' and then capture its nodeValue as the value of the previous node.

$doc = new DOMDocument();
// OR 

$xpath = new DOMXpath( $doc );
$elements = $xpath->query("//tr");

$attributes = array();

//Loop over every row object
foreach( $elements as $row ){

  //Look over each cell in each row
  foreach( $row as $cell ){
    //We only care about TH cells so we only look for those specifically
    if( strtoupper($cell->nodeName) == 'TH' ){
      //If we find a TH cell then check if we have an adjacent TD cell.
      if( strtoupper($cell->nextSibling->nodeName == 'TD' ){
        //Create an array item using the TH's value as the key and the TD's value as the value.  e.g. $attributes['Beds'] = 7
        $attributes[$cell->nodeValue] = $cell->nextSibling->nodeValue;





This is just an EXAMPLE and I make to guarantee this is efficient or even works. It is just to illustrate the concept I was trying to explain.

Read the documentation I linked too, looked at the example code, try to implement it in your use case and ask any additional questions you have, i'll do my best to help you.

what is the source of the data in the table, there may be a different approach that works,

what is the source of the data in the table, there may be a different approach that works,

i donn't know why i got down.. rate.... any way

that works for me ....