[eluser]Future Webs[/eluser]
View - List
Code:
<p><?php echo anchor('/example/form/' , 'Add New Example'); ?></p>
<table width="100%" border="1" cellspacing="2" cellpadding="4" class="AdminTable">
<tr class="AdminTableHeader">
<td> </td>
<td> </td>
<td>Id</td>
<td>Text</td>
<td>Radio</td>
<td>Checkbox</td>
<td>Drop menu</td>
<td>Date Added</td>
<td>Date Updated</td>
</tr>
<?php foreach ($rs_examples as $row_rs_examples) : ?>
<tr>
<td><?php echo anchor('/example/form/'.$row_rs_examples->example_id , 'Edit'); ?></td>
<td><?php echo anchor('/example/delete_example/'.$row_rs_examples->example_id, 'Delete' ); ?></td>
<td><?php echo $row_rs_examples->example_id ; ?></td>
<td><?php echo $row_rs_examples->example_text ; ?></td>
<td><?php echo $row_rs_examples->example_radio ; ?></td>
<td><?php echo $row_rs_examples->example_checkbox ; ?></td>
<td><?php echo $row_rs_examples->example_dropmenu ; ?></td>
<td><?php echo $row_rs_examples->example_date_added ; ?></td>
<td><?php echo $row_rs_examples->example_date_updated ; ?></td>
</tr>
<?php endforeach ; ?>
</table>
<pre>
<?php print_r($rs_examples) ; ?>
</pre>
Demo Sql
Code:
--
-- Table structure for table `examples`
--
CREATE TABLE IF NOT EXISTS `examples` (
`example_id` int(10) NOT NULL auto_increment,
`example_text` varchar(50) NOT NULL,
`example_radio` int(5) NOT NULL,
`example_checkbox` int(5) NOT NULL,
`example_dropmenu` varchar(25) NOT NULL,
`example_date_added` datetime NOT NULL,
`example_date_updated` datetime NOT NULL,
KEY `example_id` (`example_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
--
-- Dumping data for table `examples`
--
INSERT INTO `examples` (`example_id`, `example_text`, `example_radio`, `example_checkbox`, `example_dropmenu`, `example_date_added`, `example_date_updated`) VALUES
(1, 'First Example', 1, 0, '1', '2008-11-18 00:00:00', '2008-11-19 01:20:13'),
(2, 'Second Example', 0, 1, '2', '2008-11-18 00:00:00', '2008-11-19 01:22:47'),
(3, 'Third Example', 1, 0, '3', '2008-11-18 00:00:00', '2008-11-19 01:20:17'),
(4, 'Fourth Example', 1, 1, '4', '2008-12-10 00:00:00', '2008-11-19 01:26:05');
-- --------------------------------------------------------
--
-- Table structure for table `example_cats`
--
CREATE TABLE IF NOT EXISTS `example_cats` (
`example_cat_id` int(10) NOT NULL auto_increment,
`example_cat_name` varchar(25) NOT NULL,
PRIMARY KEY (`example_cat_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `example_cats`
--
INSERT INTO `example_cats` (`example_cat_id`, `example_cat_name`) VALUES
(1, 'First Category'),
(2, 'Second Category'),
(3, 'Third Category'),
(4, 'Fourth Category');
Continued in next post ...