datetime to be displayed on the Web, you (Photoshop web design)

datetime to be displayed on the Web, you can format it any way that you want. The standard datetime format for September 21, 2003, 12:42 a.m. is 2003-09-21 00:42:00. $sql = INSERT INTO cms_articles . (title,body, author_id, date_submitted) . VALUES ( . $_POST[ title ] . , . $_POST[ body ] . , . $_SESSION[ user_id ] . , . date( Y-m-d H:i:s ,time()) . ) ; mysql_query($sql, $conn) or die( Could not submit article; . mysql_error()); } redirect( index.php ); break; The Edit case is simple. The compose.php page is set up to retrieve an article and preload it into the title and body fields if the appropriate data is entered in the URL. You simply need to add a=edit and article=xx to the URL and redirect the user to that URL. case Edit : redirect( compose.php?a=edit&article= . $_POST[ article ]); break; Make sure the title and body fields have been filled in, and that the hidden field article contains a value. If you were composing a new document, the hidden field would not contain anything, and you d know something was wrong. (You can t use the Save Changes feature for a new document.) case Save Changes : if (isset($_POST[ title ]) and isset($_POST[ body ]) and isset($_POST[ article ])) { Next you send the article to the database. If the hidden field authorid has a value, then a user is editing her or his own document, and you must add the condition to match the author_id to the SQL statement. $sql = UPDATE cms_articles . SET title= . $_POST[ title ] . , body= . $_POST[ body ] . , date_submitted= . date( Y-m-d H:i:s , time()) . . WHERE article_id= . $_POST[ article ]; if (isset($_POST[ authorid ])) { $sql .= AND author_id= . $_POST[ authorid ]; } mysql_query($sql, $conn) or die( Could not update article; . mysql_error()); } You then redirect the user to either the control panel, if the user is editing his or her own document, or the review page, if the user is a moderator or admin editing someone else s document. 441 Building a Content Management System
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Leave a Reply