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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.