Php 简单计划模式数据库
我想做一个简单的计划: 我是这样做的: CREATE TABLE IF NOT EXISTS `plan` ( `id` int(20) NOT NULL AUTO_INCREMENT, `a` varchar(25) NOT NULL, `b` varchar(25) NOT NULL, `c` varchar(25) NOT NULL, `d` varchar(25) NOT NULL, `e` varchar(25) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; 如果不存在“计划”,则创建表( `id`int(20)非空自动增量, `a`varchar(25)不为空, `b`varchar(25)不为空, `c`varchar(25)不为空, `d`varchar(25)不为空, `e`varchar(25)不为空, 主键(`id`) )ENGINE=InnoDB默认字符集=latin1自动增量=5; 但效果不太好 我希望TD中的每个单元格都有一个唯一的ID 现在是: foreach($rows as $row) { id(); ?>>id() ?> id(); ?>>A() ?> id(); ?>>B() ?> id(); ?>>C() ?> id(); ?>>D() ?> id(); ?>>E() ?> } foreach($行作为$行) { id();?>>id()?> id();?>>A()?> id();?>>B()?> id();?>>C()?> id();?>>D()?> id();?>>E()?> } 现在我不能说一个TD。我想编辑,例如只ID:20 如何最好地规划数据库 谢谢你的帮助 每个单元格/Php 简单计划模式数据库,php,mysql,database,schema,Php,Mysql,Database,Schema,我想做一个简单的计划: 我是这样做的: CREATE TABLE IF NOT EXISTS `plan` ( `id` int(20) NOT NULL AUTO_INCREMENT, `a` varchar(25) NOT NULL, `b` varchar(25) NOT NULL, `c` varchar(25) NOT NULL, `d` varchar(25) NOT NULL, `e` varchar(25) NOT NULL, PRIMARY KEY
不需要ID。将ID放在行/
上,就像您在数据库架构中所做的那样
之后,识别每行的不同列应该是一项简单的任务
数据库:
| id | a | b | c | d | e |
--------------------------
| 1 | t | t | t | t | t |
HTML:
<table>
<tr>
<th>id</th>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
</tr>
<tr class="id-1">
<td class="id">1</td>
<td class="a">t</td>
<td class="b">t</td>
<td class="c">t</td>
<td class="d">t</td>
<td class="e">t</td>
</tr>
<tr class="id-2">
<td class="id">2</td>
<td class="a">u</td>
<td class="b">u</td>
<td class="c">u</td>
<td class="d">u</td>
<td class="e">u</td>
</tr>
</table>
身份证件
A.
B
C
D
E
1.
T
T
T
T
T
2.
U
U
U
U
U
或者我误解了你;) 每个单元格/
不需要ID。将ID放在行/
上,就像您在数据库架构中所做的那样
之后,识别每行的不同列应该是一项简单的任务
数据库:
| id | a | b | c | d | e |
--------------------------
| 1 | t | t | t | t | t |
HTML:
<table>
<tr>
<th>id</th>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
</tr>
<tr class="id-1">
<td class="id">1</td>
<td class="a">t</td>
<td class="b">t</td>
<td class="c">t</td>
<td class="d">t</td>
<td class="e">t</td>
</tr>
<tr class="id-2">
<td class="id">2</td>
<td class="a">u</td>
<td class="b">u</td>
<td class="c">u</td>
<td class="d">u</td>
<td class="e">u</td>
</tr>
</table>
身份证件
A.
B
C
D
E
1.
T
T
T
T
T
2.
U
U
U
U
U
或者我误解了你;) 谢谢,但是现在:id | a | b | c | d | e----------------------1 | t | t | t | t | t | t | t例如:1a==2a,1e==2e,所以我不能只编辑2e,但也编辑1e抱歉,做了一些编辑。出了什么问题?你的评论看起来很简短。你没有说真正的问题是什么。是否存在MySQL问题?您可以通过执行更新计划集e='some new value',其中id='2'来更新“2e”。否:)我将通过CSS访问单个TD。我将在ID:20中添加CSS背景色:红色,但realy ID“ID:20”与ID:19、ID:18、ID:17、ID:16相同,使用上面的HTML:
table tr.ID-2td.e{background color:red}
谢谢,但现在:ID | a | b | c | d | e-------------------------------------------1 | t | t | t | t | t | t | t | t | t | t | t | t 1241a |例如,t=t:2a,1e==2e,所以我不能只编辑2e,但还要编辑1e对不起,做了一些编辑。出了什么问题?你的评论看起来很简短。你没有说真正的问题是什么。是否存在MySQL问题?您可以通过执行更新计划集e='some new value',其中id='2'来更新“2e”。否:)我将通过CSS访问单个TD。我将只在ID:20中添加CSS背景色:红色,但realy ID“ID:20”与ID:19、ID:18、ID:17、ID:16相同这应该可以工作,使用上面的HTML:table tr.ID-2td.e{background color:red}