Hey All,
I want to be able to take the output of a table of data and link to a particular field of it so that if the user wants to edit the data they can. Each record has a unique ID called refnum. This is a keyed primary field in the db. By selecting this the user needs to able to edit that particular record and then resend it back into the database by using a sql “alter table” command.
here is the table creation page:
[code=php]
<?php
$result = $db->query($query);
$num_results = $result->num_rows;
echo ‘<p>Number of Records found: ‘.$num_results.'</p>’;
for ($i=0; $i < $num_results; $i++)
{
$row = $result->fetch_assoc();
//echo ‘<p><strong>Record #’ . ($i+1) .'</p>’;
echo ‘<table border=”2″>’;
echo ‘<tr>’;
echo ‘<tbody bgcolor=”lightgreen”>’;
echo ‘<td><strong>Record #</td>’;
echo ‘<td><strong>Name</td>’;
echo ‘<td><strong>ID</td>’;
echo ‘<td><strong>Server</td>’;
echo ‘<td><strong>Event</td>’;
echo ‘<td><strong>Database</td>’;
echo ‘<td><strong>Timestamp</td>’;
echo ‘<td><strong>Completed Date</td>’;
echo ‘<td><strong>Reference</td>’;
echo ‘</tr>’;
echo ‘<tr>’;
echo ‘<tbody bgcolor=”lightyellow”>’;
echo ‘<td>’ . ($i+1) .'</td>’;
echo ‘<td>’.stripslashes($row[‘name’]).'</td>’;
echo ‘<td>’.stripslashes($row[‘id’]).'</td>’;
echo ‘<td>’.stripslashes($row[‘server’]).'</td>’;
echo ‘<td>’.stripslashes($row[‘event’]).'</td>’;
echo ‘<td>’.stripslashes($row[‘dbname’]).'</td>’;
echo ‘<td>’.stripslashes($row[‘datetime’]).'</td>’;
echo ‘<td>’.stripslashes($row[‘wdate’]).'</td>’;
echo ‘<td> ‘.stripslashes($row[‘refnum’]).'</td>’;
echo ‘</tbody></tr></table>’;
echo ‘<strong>Description: <br /></strong>’;
echo ‘<textarea rows=”15″ cols=”100″ “12”>’;
echo str_replace(“<br />”,””,stripslashes($row[‘description’]));
echo ‘</textarea>’;
echo ‘<br />’;
echo ‘<br />’;
echo ‘<hr style=”width: 100%; height: 2px;”>’;
}
?>
How do I create the array ( I am assuming this would be the best way) and what would be the best way to edit the page via this method? tia!