![]() ![]() And if I put a number instead of the default value that is not already in the table it works, so I really don't understand where the problem is.ĮDIT: The table structure on the database:ĮDIT 2: I tried to delete the table and create it again, and now it works with the NULL thing. In MySQL, if you have an autoincrement column you don't need to put it in the insert statement. I search similar questions here in stackoverflow, and I try to use DEFAULT or NULL, but it doesn't work. The 'insert.php' file connects to the MySQL database server, retrieves forms fields using the PHP REQUEST variables and finally execute the insert query to add the. In order to avoid SQL injections and other vulnerabilities that come with the integration of variables straight in the SQL statement (not a huge problem in this case, but it's good practice), you can use PDO with prepared statements. When a user clicks the submit button of the add record HTML form, in the example above, the form data is sent to 'insert.php' file. ![]() The following columns exist in the vote table: movieID, userID, yesNo, and yes. Step 2: Retrieving and Inserting the Form Data. VALUES (DEFAULT, '$nome', '$cognome', '$username', '$password', '$nTelefono', '$email')" I'm able to successfully connect to the database and get data from the votes table, but for some reason, I'm having trouble using INSERT INTO. What I'm actually trying to do is insert a row with:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |