Hi,
I'm developing a php script that reads data from a mysql db and then puts the data into csv format to then be sent upto Pachube.com for a web app i'm developing. This is a simple problem i'm sure but i cant seem to solve it!
Code below:
<?php
require_once( '../Pachube_PHP_library/pachube_functions.php' );
$api_key = "xxxxxxxxxxxxxxxx";
$pachube = new Pachube($api_key);
echo "<b>Update a manual feed with CSV: </b>";
$url = "http://www.pachube.com/api/xxxx.csv";
$data = $numrows, $numrows1; --------------Problem is here, it doesn't like the format!
$update_status = $pachube->updatePachube ( $url, $data );
$pachube->debugStatusCode($update_status);
$csv = $pachube->retrieveData ( $url );
echo "<br />";
echo "<br />";
echo $csv;
echo "<br />";
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
$result1 = mysql_query("SELECT timer1 FROM pachubevb order by id desc limit 1");
$numrows=mysql_result($result1,0);
echo $numrows;
echo "<br />";
$result2 = mysql_query("SELECT timer2 FROM pachubevb order by id desc limit 1");
$numrows1=mysql_result($result2,0);
echo $numrows1;
?>
So how do a get two variables "$numrows" and "$numrow1" into a csv format? ie. "value, value"?
Thanks