PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY The
PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY The ON UPDATE CURRENT_TIMESTAMP and CURRENT_TIMESTAMP options aren t available on older versions of phpMyAdmin and/or MySQL. This doesn t matter, because the default is for the first TIMESTAMP column in a table to update automatically whenever a record is updated. You don t want the second TIMESTAMP column to update, in order to keep track of when a record was originally created. Creating the basic insert and update form SQL makes an important distinction between inserting and updating records by providing separate commands. INSERT is used only for creating a brand new record. Once a record has been inserted, any changes must be made with UPDATE. Since this involves working with identical fields, you can use the same page for both operations. However, this makes the PHP more complex, so I prefer to create the insert page first, save a copy as the update page, and then code them separately. The form in the insert page needs just two input fields: for the title and the article. The contents of the remaining three columns (the primary key and the two timestamps) are handled automatically either by MySQL or by the SQL query that you will build shortly. The code for the insert form looks like this:
You can find the full code in journal_insert01.php in the download files for this chapter. The content management forms have been given some basic styling with admin.css, which should be placed in the assets folder. When viewed in a browser, the form looks like this:
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.