Jump to content

how could i improve this ;/


Recommended Posts

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...