basic-php-08-commit-rev01.php / php
<?php // COMMIT ADD AND EDITS link = mysql_connect("localhost", "bp5am", "bp5ampass") or die("Could not connect: " . mysql_error()); mysql_select_db('moviesite', _GET['action']) { case "edit": switch (sql = "UPDATE people SET " . "people_fullname = '" . _GET['id'] . "'"; break; case "movie": _POST['movie_name']); if (empty(error .= "Please+enter+a+movie+name%21%0D%0A"; } if (empty(error .= "Please+select+a+movie+type%21%0D%0A"; } if (empty(error .= "Please+select+a+movie+year%21%0D%0A"; } if (empty(sql = "UPDATE movie SET " . "movie_name = '" . _POST['movie_year'] . "'," . "movie_type = '" . _POST['movie_leadactor'] . "'," . "movie_director = '" . _GET['id']."'"; } else { header("location:movie.php?action=edit&error=" . _GET['id'] ); } break; } break; case "add": switch (sql = "INSERT INTO people (people_fullname) " . "VALUES ('" . movie_name = trim(movie_name)) { _POST['movie_type'])) { _POST['movie_year'])) { error)) { _POST['movie_name'] . "'," . "'" . _POST['movie_type'] . "'," . "'" . _POST['movie_director'] . "')"; } else { header("location:movie.php?action=add&error=" . sql) && !empty(sql."-->"; sql) or die("Invalid query: " . mysql_error()); ?> <p align="center" style="color:#FF0000"> Done. <a href=<index.php>>Index</a> </p> <?php } ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.