ikkyino Posted February 7, 2008 Share Posted February 7, 2008 hey, this forum is my new best friend! hah.so my question of the hour is would this work for a quick way to delete a row? well I know it won't work otherwise i wouldn't be asking, so my question really is.. how could i get this to work or something similar? mysql_query("DELETE FROM movies WHERE id='". $_post['id'] . "')");while($row = mysql_fetch_array($result)){echo "<tr>";echo "<td>" . $row['Title'] . "</td>";echo "<td>" . $row['Rate'] . "</td>";echo "<td>" . $row['Length'] . "</td>";echo "<td><form action='movies.php' method='post'><input type='submit' value='" . $row['Id'] . "'/></form></td>";echo "</td>";} thank you-Ikky Link to comment Share on other sites More sharing options...
Synook Posted February 7, 2008 Share Posted February 7, 2008 This should work mysql_query("DELETE FROM movies WHERE id='". $_POST['submit'] . "')");echo "<form action='{$_SERVER['PHP_SELF']}' method='post'><table>";//Connect to the table and SELECTwhile($row = mysql_fetch_array($result)){echo "<tr>";echo "<td>" . $row['Title'] . "</td>";echo "<td>" . $row['Rate'] . "</td>";echo "<td>" . $row['Length'] . "</td>";echo "<td><input type='submit' name=\"submit\" value='" . $row['Id'] . "' /></td>";echo "</tr>";}echo "</table></form>"; Of course, this has horrible security. If you have this for a production site, have user verification. Link to comment Share on other sites More sharing options...
ikkyino Posted February 7, 2008 Author Share Posted February 7, 2008 no that's not wanting to work for me either... it all seems like it should work, but it never actually deletes it... Link to comment Share on other sites More sharing options...
ikkyino Posted February 7, 2008 Author Share Posted February 7, 2008 found the problem.. mysql_query("DELETE FROM movies WHERE id='". $_POST['submit'] . "')"); there's an extra ) where there shouldn't be. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.