Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 用于条形图的html和java脚本,其中包含来自数据库的数据_Javascript_Html_Mysql - Fatal编程技术网

Javascript 用于条形图的html和java脚本,其中包含来自数据库的数据

Javascript 用于条形图的html和java脚本,其中包含来自数据库的数据,javascript,html,mysql,Javascript,Html,Mysql,我希望得到从MySQL数据库表调用的数据的当前表表示形式,以便更好地显示为条形图或饼图。我在Dreamweaver CS5.5上,没有CF。我更喜欢用HTML和JavaScript将其写入如下所示的当前页面。有人有什么想法吗?我的当前页面已附加。谢谢,罗斯 <title>Results4</title> </head> <body> <form action="resultsparta4.php" method="post"> &l

我希望得到从MySQL数据库表调用的数据的当前表表示形式,以便更好地显示为条形图或饼图。我在Dreamweaver CS5.5上,没有CF。我更喜欢用HTML和JavaScript将其写入如下所示的当前页面。有人有什么想法吗?我的当前页面已附加。谢谢,罗斯

<title>Results4</title>

</head>
<body>

<form action="resultsparta4.php" method="post">
<script>
function myFunction()
{
window.print();
 }
</script>
<?
$client_id =$_POST['clientid'];

print "<table border=5 align= \"center\" width=\"75%\"  >";
print "<tr><td><h2>Results page 4: Your results are ranked below </h2></b></p> </td></tr>";

// access the apache web server

 $host = "localhost";
 $user = "root";
 $pwd = "";

 $connect = mysql_connect($host,$user,$pwd);

 // set up the database variable

 $db = "clients";

 //set up the select query

 $query = "SELECT a.client_id, a.percent, b.percent, c.percent, d.percent
 FROM apples a, oranges b, pears c,
grapefruit d
WHERE a.client_id = b.client_id 
AND b.client_id = c.client_id 
AND c.client_id = d.client_id
ORDER BY client_id DESC";

// connect to a database and create a query

$result = mysql_db_query($db,$query);
$row = mysql_fetch_array($result);
$list=array();

$a = $row[1]; 
$b = $row[2];
$c = $row[3];
$d = $row[4];

$list = array('apples %'=>$a,
'oranges %'=>$b,'pears %'=>$c,'grapefruit %'=>$d);
print "<table border=5 align= \"center\" width=\"75%\"  bgcolor=\"BD9DFF\">";
print "<tr><td><h2>Section </h2></td><td><h2>Percent 
</h2></td></tr>";
arsort($list);
foreach ($list as $key => $val)

{ 
//set up the table and headings
print "<tr><td><h2>$key</h2></td><td><h2>$val</h2></td></tr>";
} 

//close the table
print "</table>";

?>
<?
$client_id =$_POST['clientid'];

print "<table border=5 align= \"center\" width=\"75%\"  >";
?>
print "<table border=5 align= \"center\" width=\"75%\"  bgcolor=\"BD9DFF\">";
print "<tr><td><h2>Section </h2></td><td><h2>Percent</h2></td></tr>";
?>
</body>
</html>

你有没有看过创建图表之类的javascript库:谢谢haakym和Paul,我会继续关注这些链接。我试图避免下载一个免费的图表,它会将我的数据返回给第三方,比如谷歌或其他任何人,这就是为什么我想为自己编写它。不管怎样,我都会看的,干杯,罗西