masterofollies
07-03-2008, 04:03 AM
I am trying to figure out how to edit a field in a database when a user wants to change something. So they make new information, submit it, the database inserts a new query. Now I need it where there is a choice to edit it. Here is the coding I am using to show all the information they have entered.
$check = mysql_query("SELECT date,location,info FROM reliclog WHERE `user` = '{$_SESSION['user_id']}'") or die(mysql_error());
echo 'This is the history log area.<br><br><br>';
echo '<table width="95%" border="1">';
echo '<tr><td width="10%"><b>Date</b></td><td width="25%"><b>Location</b></td><td width="60%"><b>Relic</b></td></tr>';
while ($row = mysql_fetch_array($check)) {
$date = $row["date"];
$info = $row["info"];
$location = $row["location"];
echo "<tr><td width=\"10%\">$date</td><td width=\"25%\">$location</td><td width=\"60%\">$info</td></tr>";
}
echo '</table>';
Can anyone point me in the right direction how to add a Edit tag that picks the exact piece of information they want to change? There is 2 things in information,
1. id - it adds +1 everytime something is inserted into the database.
2. user - this is the id of the user that uploaded the new information.
$check = mysql_query("SELECT date,location,info FROM reliclog WHERE `user` = '{$_SESSION['user_id']}'") or die(mysql_error());
echo 'This is the history log area.<br><br><br>';
echo '<table width="95%" border="1">';
echo '<tr><td width="10%"><b>Date</b></td><td width="25%"><b>Location</b></td><td width="60%"><b>Relic</b></td></tr>';
while ($row = mysql_fetch_array($check)) {
$date = $row["date"];
$info = $row["info"];
$location = $row["location"];
echo "<tr><td width=\"10%\">$date</td><td width=\"25%\">$location</td><td width=\"60%\">$info</td></tr>";
}
echo '</table>';
Can anyone point me in the right direction how to add a Edit tag that picks the exact piece of information they want to change? There is 2 things in information,
1. id - it adds +1 everytime something is inserted into the database.
2. user - this is the id of the user that uploaded the new information.