本文介绍了如何从表格测量中显示记录并在表格进度中保存相关记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......我试图显示来自度量的记录(字段:度量,目标(主键),目标)并将记录插入进度(字段:targetid(外键),progressid(主键),进度,评论)。这种关系由targetid联系起来。请告知以下编码...非常感谢。






$ con = mysqli_connect(localhost,username,,database);

//检查连接

if(mysqli_connect_errno ()){

echo无法连接到MySQL:。 mysqli_connect_error();

}

$ result = mysqli_query($ con,SELECT Measure,target FROM target);

echo

;



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

echo;

echo;

echo;

echo;

}

echo

测量 目标
。 $ row ['Measure']。 。 $ row ['目标']。
;



mysqli_close($ con);

< ; form action =progress.phpmethod =post>

目标



进度:<输入类型= textname =progress>



评论:< input type =textname =Comment>



< input type =Submitname =Submit>

< / form>

if(isset($ _ POST ['Submit' ])){

$ con = mysql_connect(localhost,username,);

if(!$ con)

{

die('无法连接:'。mysql_error());

}

mysql_select_db(database,$ con) ;



//将数据放入数据库

$ sql =插入进度(进度,注释)值('$ _POST [进度]','$ _ POST [评论]');

mysql_query($ sql,$ con);

mysql_close($ con);

}

?>

解决方案




Hi everyone...am trying to display record from measure (field:measure,targetid(primary key),target) and insert record into progress (field:targetid(foreign key),progressid(primary key),progress,comment).The relationship is linked by targetid. Please advise on the coding below...Thanks a lot.


$con=mysqli_connect("localhost","username","","database");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT Measure,target FROM target");
echo "
";

while($row = mysqli_fetch_array($result)) {
echo "";
echo "";
echo "";
echo "";
}
echo "

MeasureTarget
" . $row['Measure'] . "" . $row['Target'] . "
";

mysqli_close($con);
<form action="progress.php" method="post">

Target


Progress:<input type="text" name="progress">


Comment:<input type="text" name="Comment">


<input type="Submit" name="Submit">
</form>
if (isset($_POST['Submit'])){
$con = mysql_connect("localhost","username","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);

//put data into database
$sql="Insert into progress (progress,Comment)values ('$_POST[progress]','$_POST[Comment]')";
mysql_query($sql,$con);
mysql_close($con);
}
?>

解决方案




这篇关于如何从表格测量中显示记录并在表格进度中保存相关记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 04:00