php mysql statement hangs?
Posted: Sun Nov 30, 2008 11:21 pm
Hi,
I'm trying to put the rfxmeter values into a mysql database with php
He puts it in but the script doesn't come to a prompt, what do I wrong?
#!/usr/bin/php
<?php
$link = mysql_connect('localhost', 'rfxcom', 'rfxcom')or die('Couldnot connect: ' . mysql_error());
mysql_select_db( "rfxcom") or die('Could not select database');
$sql = "SELECT power FROM rfxpower ORDER by time DESC";
$query = mysql_query($sql);
$result = mysql_result($query, 0);
$data = shell_exec('/usr/local/bin/heyu rfxpower l2');
$verbruik = $data - $result;
$query2 = "insert into rfxpower(power,verbruik) values
('$data','$verbruik')";
mysql_query($query2);
// Free resultset
mysql_free_result($query);
// Closing connection
mysql_close($link);
?>
I'm trying to put the rfxmeter values into a mysql database with php
He puts it in but the script doesn't come to a prompt, what do I wrong?
#!/usr/bin/php
<?php
$link = mysql_connect('localhost', 'rfxcom', 'rfxcom')or die('Couldnot connect: ' . mysql_error());
mysql_select_db( "rfxcom") or die('Could not select database');
$sql = "SELECT power FROM rfxpower ORDER by time DESC";
$query = mysql_query($sql);
$result = mysql_result($query, 0);
$data = shell_exec('/usr/local/bin/heyu rfxpower l2');
$verbruik = $data - $result;
$query2 = "insert into rfxpower(power,verbruik) values
('$data','$verbruik')";
mysql_query($query2);
// Free resultset
mysql_free_result($query);
// Closing connection
mysql_close($link);
?>