读取mysql表并提供删除选项的简单html页面 [英] simple html page that reads mysql table and give option to delete

查看:60
本文介绍了读取mysql表并提供删除选项的简单html页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是php的新手,正在从事一个小项目.
我有一个php页面,可从mysql数据库读取所有信息并将其显示在html表中.
我想在表格的末尾放置2个按钮,单击这些按钮必须接受或拒绝/删除该条目.

这是我到目前为止的内容:

Hi,
I am new to php and working on a small project.
I have a php page that reads all info from a mysql database and display it in a html table.
I want to place 2 buttons at the end of the table that when clicked must either accept or reject/delete the entry.

Here is what I have so far:

$query="SELECT * FROM to3rd_temp";<br />
$result=mysql_query($query);<br />
$num=mysql_numrows($result);<br />
<br />
mysql_close();<br />
<br />
echo "<center>Database Output</center><br><br>";<br />
<br />
// Draw table Header<br />
echo "<table border="2"><tr><br />
<td>header 1</td><br />
<td>header2</td><br />
//Removed code to make post shorter<br />
<td>Accept/Reject</td><br />
</tr>";<br />
<br />
//Loop all info in DB<br />
$i=0;<br />
<br />
while ($i < $num) {<br />
<br />
$id=mysql_result($result,$i,"id");<br />
$datesub=mysql_result($result,$i,"datesub");<br />
//Removed code to make post shorter<br />
$value=mysql_result($result,$i,"value");<br />
<br />
echo "<tr> <br />
<td>$datesub</td><br />
<td>$dateocc</td><br />
//Removed code to make post shorter<br />
<td><input type=''button'' name=''button1'' value=''Accept''> <br />
 <br><br />
<input type=''button'' value=''Reject''><br />
</br></td><br />
</tr>";<br />
<br />
$i++;<br />
}<br />
// Close Table<br />
echo "</table>";<br />
echo "<center><a href="index.php">Back</a></center><br><br>";<br />
</br></br></br></br>




如果有人可以帮助我使按钮起作用,我将不胜感激.

谢谢.




If someone could please assist me to get the buttons to work I would greatly appreciate it.

Thank you.

推荐答案

query ="SELECT * FROM to3rd_temp";< br/>
query="SELECT * FROM to3rd_temp";<br />


result = mysql_query(
result=mysql_query(


query);< br/>
query);<br />


这篇关于读取mysql表并提供删除选项的简单html页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆