php查询在同一页面显示,PHP:从同一页面上的表单输入和ph​​p内的sql查询显示图形和o / p...

我正在处理一些问题,我有一个HTML页面,它做表单输入,并采用两个值(开始日期和结束日期),然后使用post方法我发布这些值在sql语句生成图我。我也试图从sql表中打印一些内容,即我想打印表的列的平均值,我试过了

这里是表单输入代码:

enter code here

Enter_Start_Date:

Enter_End_Date:

Enter_Type:

Enter_Type:

这里是test.php,它应该在同一页面上显示图形和打印平均值,当我执行此代码时,它会在webapge上显示一些垃圾信息:

include("phpgraphlib.php");

$graph = new PHPgraphLib(1000,1000);

$host = 'host';

$port = '3306';

$server = $host . ':' . $port;

$user = 'root'; $password = 'root';

$link = mysql_connect ($server, $user, $password);

if (!$link)

{

die('Error: Could not connect: ' . mysql_error());

}

$database = 'jira';

mysql_select_db($database);

$query = ("select pkey, numbervalue

from jiraissue ji

join customfieldvalue cf on ji.id = cf.issue

join resolution r on ji.resolution = r.id

join issuestatus isst on ji.issuestatus = isst.id

join issuetype isstype on ji.issuetype = isstype.id

join label lb on ji.id = lb.issue

where numbervalue is not null

and isstype.pname in ('Ticket')

and lb.label in ('$_POST[pkey3]', ' $_POST[pkey4]')

and ji.updated between '$_POST[pkey1]' and '$_POST[pkey2]'");

$result = mysql_query($query);

if ($result) {

while ($row = mysql_fetch_assoc($result)) {

$customvalue=$row["pkey"];

$count=$row["numbervalue"];

//add to data array

$dataArray[$customvalue]=$count;

}

}

//configure graph

$graph->addData($dataArray);

$graph->setTitle("test");

$graph->setGradient("lime", "green");

$graph->setBarOutlineColor("black");

$graph->createGraph();

?>

include("phpgraphlib.php");

$graph = new PHPgraphLib(1000,1000);

$host = 'host';

$port = '3306';

$server = $host . ':' . $port;

$user = 'root'; $password = 'root';

$link = mysql_connect ($server, $user, $password);

if (!$link)

{

die('Error: Could not connect: ' . mysql_error());

}

$database = 'jira';

mysql_select_db($database);

$query = ("select avg(numbervalue) as avg_hrs

from jiraissue ji

join customfieldvalue cf on ji.id = cf.issue

join resolution r on ji.resolution = r.id

join issuestatus isst on ji.issuestatus = isst.id

join issuetype isstype on ji.issuetype = isstype.id

join label lb on ji.id = lb.issue

where numbervalue is not null

and isstype.pname in ('Certification Ticket')

and lb.label in ('$_POST[pkey3]', ' $_POST[pkey4]')

and ji.updated between '$_POST[pkey1]' and '$_POST[pkey2]'");

$result = mysql_query($query);

if (!$result)

{

$message = 'ERROR:' . mysql_error();

return $message;

}

else

{

$i = 0;

echo ' ';

while ($i < mysql_num_fields($result))

{

$meta = mysql_fetch_field($result, $i);

echo ' ' . $meta->name . ' ';

$i = $i + 1;

} echo ' ';

$i = 0;

while ($row = mysql_fetch_row($result))

{

echo ' '; $count = count($row);

$y = 0;

while ($y < $count)

{

$c_row = current($row);

echo ' ' . $c_row . ' ';

next($row);

$y = $y + 1;

}

echo ' ';

$i = $i + 1;

} echo ' ';

mysql_free_result($result);

}

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值