Code:<?php $conn = mysql_connect('localhost', '', ''); mysql_select_db('smiletest'); $tablename = 'request'; $uniquerow = '(ID)'; if(isset($_GET['delete'])) if(!is_numeric($_GET['delete'])) die(); else mysql_query('delete from `' . $tablename . '` where ' . $uniquerow . '=\'' . $_GET['delete'] . '\';'); $rs = mysql_query('select * from `' . $tablename . '`;'); $row = mysql_fetch_array($rs); $cols = array(); foreach($row as $k => $v) array_push($cols, $k); array_push($cols, 'del'); echo('<table><tr>'); for($i = 0; $i < count($cols); ++$i) echo('<th>' . $cols[$i] . '</th>'); echo('</tr>'); do { $row['del'] = '<form action="?delete=' . $row[$uniquerow] . '" method="get"><input type="submit" value="Delete"></form>'; echo('<tr>'); for($i = 0; $i < count($cols); ++$i) { ?> <td><?php echo($row[$i]); ?></td> <?php } echo('</tr>'); } while($row = mysql_fetch_array($rs)); echo('</table>'); ?>Should work if you just change the details.



Reply With Quote


Bookmarks