2011-06-05 69 views
1

我想作一个简单的计划: enter image description here 我没有这样的事:简单的计划 - 架构数据库

 
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 ; 

,但它不工作也很好......

祝每个单元在TD中都有唯一的ID。

现在是:

 

    foreach($rows as $row) 
    { 
      
      id(); ?>>id() ?> 
      id(); ?>>A() ?> 
      id(); ?>>B() ?> 
      id(); ?>>C() ?> 
      id(); ?>>D() ?> 
      id(); ?>>E() ?> 
      
    } 

,现在我不能指单个TD。我会像编辑例如只编号:20。

如何最好的计划数据库?

感谢您的帮助!

回答

1

每个单元/ <td>不需要一个ID。正如你在数据库模式中所做的那样,将ID放在行/ <tr>上。

之后,它应该是一项简单的任务,以确定每行不同的列。

数据库:

| 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> 

还是我误解你;)

+0

感谢,但现在:

 id | a | b | c | d | e ----------------------- 1 | t | t | t | t | t 2 | t | t | t | t | t 
例如:1A == 2A, 1e == 2e,所以我不能编辑只有2e,但是然后编辑1e – andanosy 2011-06-05 15:44:49

+0

对不起,做了一些编辑。有什么问题?您的评论看起来剪辑。例如# – Znarkus 2011-06-05 15:46:09

+0

在css中编辑#id_2e {background-color:red}; – andanosy 2011-06-05 15:49:02