Dunque scrivi la stringa MysqlOriginariamente inviato da jrm
Ciao a tutti
come già detto in altre discussioni, di PHP ne so pochissimo...
sto scrivendo un piccolo form per cancellare i dati da un DB MySQL, sbaglio qualcosa, ma non capisco dove :dry:, immagino che l'errore e gnubbo ma .....
codice PHP (Recorddelete.php):
codice PHP della FORM (Recorddeleteform.php):codice:<?php session_start(); $nomeutente = $_SESSION['nomeutente']; // Connessione MySQL $con = mysql_connect("localhost","root","root") or die("Errore connessione MySQL"); mysql_select_db("school", $con) or die("Errore connessione database"); // DELETE sulla tabella 'student' mysql_query("DELETE FROM student WHERE id=".$id); echo "<HTML><HEAD><SCRIPT TYPE='TEXT/JAVASCRIPT'>location.href='Recorddeleteform.php';</SCRIPT></HEAD><BODY></BODY></HTML>"; mysql_close($con) ?>
grazie in anticipo per l'aiuto...codice:<?php session_start(); $nomeutente = $_SESSION['nomeutente']; ?> <head> <title>Form Delete Data</title> </head> <body table border="1"> <tr> <td align="center">Form Delete Student Data</td> </tr> <tr> <td> <table> <form method="post" action="Recorddelete.php"> <tr> <td>ID</td> <td><input type="text" name="id" size="5"> </td> </tr> <tr> <td></td> <td align="right"><input type="submit" name="submit" value="Sent"></td> </tr> </table> </td> </tr> </table> </body> </html>
RM
mysql_query("DELETE FROM student WHERE id=".$id);
ma la variabile $id non l'hai mai popolata.
prova con
mysql_query("DELETE FROM student WHERE id=".$_POST["id"]);
oppure
$id = $_POST["id"];
mysql_query("DELETE FROM student WHERE id=".$id);