I have the following PHP code

<?php


   // SimpleHTMLDom Library
    require_once('simple_html_dom.php');

    // Source Data
    $source = 'table-array-data.htm';

    // Displays Extra Debug Info
    $dbg = 1;

    // Read DOM
    $html = file_get_html('http://www.ercot.com/content/cdr/html/real_time_system_conditions');
	
	// get the table. Maybe there's just one, in which case just 'table' will do
//$table = $html->find('#theTable');

// initialize empty array to store the data array from each row
$theData = array();

// loop over rows
 foreach ($html->find('table') as $table) {
 }
foreach($table->find('tr') as $row) {

    // initialize array to store the cell data from each row
    $rowData = array();
    foreach($row->find('td') as $cell) {

        // push the cell's text to the array
        $rowData[] = $cell->plaintext;
    }

    // push the row's data array to the 'big' array
    $theData[] = $rowData;
}

var_dump($theData);

?>

Which outputs ->

array
  0 => 
    array
      empty
  1 => 
    array
      0 => string 'Last Updated Oct 31 2011 16:57:00 CDT' (length=37)
  2 => 
    array
      empty
  3 => 
    array
      0 => string 'Current Frequency' (length=17)
      1 => string '59.984' (length=6)
  4 => 
    array
      0 => string 'Instantaneous Time Error' (length=24)
      1 => string '-0.558' (length=6)
  5 => 
    array
      empty
  6 => 
    array
      0 => string 'Actual System Demand' (length=20)
      1 => string '33882' (length=5)
  7 => 
    array
      0 => string 'Total System Capacity (not including Ancillary Services)' (length=56)
      1 => string '37155' (length=5)
  8 => 
    array
      0 => string 'Total Wind Output (hourly average)' (length=34)
      1 => string '1355' (length=4)
  9 => 
    array
      empty
  10 => 
    array
      0 => string 'DC_E (East)' (length=11)
      1 => string '-261' (length=4)
  11 => 
    array
      0 => string 'DC_L (Laredo VFT)' (length=17)
      1 => string '0' (length=1)
  12 => 
    array
      0 => string 'DC_N (North)' (length=12)
      1 => string '0' (length=1)
  13 => 
    array
      0 => string 'DC_R (Railroad)' (length=15)
      1 => string '0' (length=1)
  14 => 
    array
      0 => string 'DC_S (Eagle Pass)' (length=17)
      1 => string '1' (length=1)

Now I'm trying to get those array values into mysql. Just trying to figure out how to assign it. I know [14][0] = DC_S (Eagle Pass)

I'm just not sure how to use those values to put them in mysql.

Anyhelp would be appreciated.

Tahnks

Is there something better i can do w/ the Values before i insert the array into MYSQL ?

Is there something better i can do w/ the Values before i insert the array into MYSQL ?

What does better means? And w/ is meaningless to my head. Please write full words!

As in is there a way i can assign this to flat values, to make this easier? or better for a cleaner script?

Im looking for this to eventually be run on a cronjob and constantly updating a dynamic table.

please post your current code and ask from there!

My current code is in the initial post.

I want the words in one column and numbers in another

so
all the 0 strings one column all the 1's in another.

so what did you do with links I gave?

I looked and looked and worked with them and found other related material.

Anyway thanks for pointing me in the right direction :) .. IM onto my next step :))

I looked and looked and worked with them and found other related material.

Anyway thanks for pointing me in the right direction :) .. IM onto my next step :))

if you hit a wall with your new code just be welcome!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.