Jump to content

Print Html table from php Array


dropfaith

Recommended Posts

Relevant Links

http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml

http://box1.host1free.com/~crimso/index.php  (right side My Treasure section)

 

 

<?php
function getPagetreasure($url="http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml"){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch,CURLOPT_REFERER,'http://www.treasuretrooper.com/');
curl_setopt($ch,CURLOPT_TIMEOUT,10);
$xmltreasure=curl_exec($ch);
if($xmltreasure==false){
  $m=curl_error(($ch));
  error_log($m);
}
curl_close($ch);
return $xmltreasure;
}


$xmlfiletreasure = getPagetreasure("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml");
$treasure =new SimpleXMLElement($xmlfiletreasure);
$resultst = array();
foreach ($treasure as $ttreasure){
$resultst[] = $ttreasure;
}

print_r($resultst);
?>

 

I have it printing the array so you guys can see whats in it..

What im trying to do is build a simple 2 column table  ie

<table>
<tr>
<td class="label">Offer Due</td>
<td>DATA FROM ARRAY HERE.</td>
</tr>
</table>



i wont be using all the data in the array on this project  prob like 4 items total

Offer_Due, Total_Due,Total_Paid  and maybe a few more as time goes on im clueless as to where to go from where my php is to where i need it to go at this point

Link to comment
https://forums.phpfreaks.com/topic/263023-print-html-table-from-php-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.