Reputation: 13
I would like to make a simple plan:
I did something like this:
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 ;
but it doesn't work too well...
I wish that every cell has a unique ID in TD.
Now is:
foreach($rows as $row) { id(); ?>>id() ?> id(); ?>>A() ?> id(); ?>>B() ?> id(); ?>>C() ?> id(); ?>>D() ?> id(); ?>>E() ?> }
and now i can't refer to a single TD. i wold like edit for example only ID: 20.
how best plan database?
thanks for help!
Upvotes: 1
Views: 176
Reputation: 24304
Every cell/<td>
doesn't need an ID. Put the ID on the row/<tr>
, as you've done in your database schema.
After that it should be a trivial task to identify the different columns per row.
The database:
| id | a | b | c | d | e |
--------------------------
| 1 | t | t | t | t | t |
The 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>
Or I've misunderstood you ;)
Upvotes: 1