前端设计师在这里,而不是一个PHP开发人员,我真的需要帮助。需要建立一个系统,允许客户登录到自己的区域来更新表格。该表格将包含约20条记录,每行将用单选按钮编辑(4个选项)。只有2列,一个用于ID,另一个称为状态(可编辑数据)。
查看器将只能看到客户端所做的更改以及根据状态对该行进行的背景颜色更改,这意味着可编辑部分必须保存2条数据(用于更改颜色和状态名称的整数值)例如单选按钮的颜色值以及按钮标签以将文本回显到单元格中)。稍后将处理登录系统...
数据库设置:
Database: test
Table: fire_alert
Structure:
id (INT, PRIMARY); color(INT); warning(VACHAR);connect.php:
// Database Variables (edit with your own server information)
$server = 'localhost';
$user = 'root';
$pass = 'root';
$db = 'test';
// Connect to Database
$connection = mysql_connect($server, $user, $pass)
or die("Could not connect to server ... \n" . mysql_error());
mysql_select_db($db)
or die("Could not connect to database ... \n" . mysql_error());
?>view.php:
// connect to the database
include('connect.php');
include("header.php");
// get results from database
$result = mysql_query("SELECT * FROM fire_alert")
or die(mysql_error());
echo "Current date - " . date("Y/m/d") . "
";
// display data in table
echo "
echo "
Area Status";// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array($result)) {
// echo out the contents of each row into a table
echo "
";echo '
' . $row['id'] . '';echo '
' . $row['warning'] . '';echo "
";}
// close table>
echo "
";echo '
Change Area Status';?>