jay_mascis

Members
  • Content count

    3
  • Joined

  • Last visited

About jay_mascis

  • Rank
    Forum Newbie
  1. Php, Mysql, Fusioncharts

    Hi , thanks for reply, no this doesn't seem to work either. "SELECT * FROM $x" does actually work, when I set $x = "table" in php file. What doesn't work though is if the variable is passed in from another file as in by $_GET or POST. The data is passed in correctly and and can echo data retrieved from mysql but just cant chart it. If i set $x in php file itself there is no problem ???
  2. Php, Mysql, Fusioncharts

    Hi, apologies if this is really stupid and simple but have been tearing hair out for last few hours. Am a newbie to php and fusioncharts Seem to behaving a problem displaying graph from php retrieved from Mysql. Php code below retrieves data from mysql and plots via fusioncharts and html. Except not really working. Receiving a variable from another php file that sets the table for mysql table. If manually put $x = "table", code works fine and graph is displayed but not when using a passed in variable!! Passed in variable is ok though and echos correct data if needed. Apologies again if seems too simple but not to me!! any help would be appreciated ?php //include("getuser.php"); $con = mysql_connect('localhost', 'root', 'admin'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("test", $con); echo $x; $result = mysql_query("SELECT * FROM $x"); / $xmlData = "<graph caption='Inactivity Status' xAxisName='Time' yAxisName='Watts' decimalPrecision='0' formatNumberScale='0'>"; while($row = mysql_fetch_array($result)) { $chart =$row['Electricity Usage']; $time =$row['Time']; $xmlData .= "<set name='" . $row['Time'] . "' value='" . $row['Electricity Usage']. "' color='000000' />"; } $xmlData .= "</graph>"; mysql_close($con); echo $xmlData; ?>