richrock Posted September 15, 2008 Share Posted September 15, 2008 Hi all, many apologies if this is a noob question, but it's something I'm not sure if it's the right way to go about something. I've created a dynamic html table based on a category search (table_categories), and displayed it with: // Create the table full of sale data while ($row = mysql_fetch_assoc($rSaleList)) { echo "<tr>\n"; echo "<td width='65'>\n"; echo $row['id']; echo "</td>\n"; echo "<td width='140'>\n"; echo "<input type='text' name='catname' value='".$row['day']."' size='1' maxlength='2' />-<input type='text' name='catname' value='".$row['month']."' size='1' maxlength='2' />-<input type='text' name='catname' value='".$row['year']."' size='3' maxlength='4' />"; echo "</td>\n"; echo "<td width='275'>\n"; echo "<input type='text' name='catname' value='".$row['catname']."' />"; //echo $row['catname']; echo "</td>\n"; echo "</tr>\n"; } As you can see, I've added the input boxes, as I intend the end user to edit any of the fields (this is accessible by an admin only) but have no idea how to write the results back to the table. I'm sure it's something like UPDATE table_category (`catid`,`catname`,`day`,`month`,`year`) VALUES ( not sure here, but pretty certain it needs to follow the array above) Help! ??? Link to comment https://forums.phpfreaks.com/topic/124291-save-html-table-to-database-table/ Share on other sites More sharing options...
Garethp Posted September 15, 2008 Share Posted September 15, 2008 mysql_query("UPDATE table_name SET column_name = '$new_value' WHERE identifier_column = '$identifier'"); So mysql_query("UPDATE members SET username = '$Username' WHERE ID = '$ID'"); as an example Link to comment https://forums.phpfreaks.com/topic/124291-save-html-table-to-database-table/#findComment-641846 Share on other sites More sharing options...
richrock Posted September 15, 2008 Author Share Posted September 15, 2008 Would I repeat this for each table row? so UPDATE... for id, name, etc individually? Sorry. This is just new to me... Link to comment https://forums.phpfreaks.com/topic/124291-save-html-table-to-database-table/#findComment-641988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.