hi i have this form wher i am trying to upload sum details include an image but its not wrking help please gives error Notice: Use of undefined constant THIS_SCRIPT - assumed 'THIS_SCRIPT' in plus details not entering into databse hlep once again please <?php define('ROOT_DIR', './'); define('THIS_SCRIPT', 'photos'); define('PROPER', TRUE); define("GALLERY_IMG_DIR", "./photos/"); define('THUMBNAIL_WIDTH', 100); /** * include common files */ include_once(ROOT_DIR. 'includes/common.inc.php'); // No album id has been selected if(isset($_POST['name'])) { $id = $_POST['id']; $name = $_POST['name']; $location = $_POST['location']; $date_of_birth = $_POST['date_of_birth']; $car_number = $_POST['car_number']; $favourite_track = $_POST['favourite_track']; $least_favourite_track = $_POST['least_favourite_track']; $achievements = $_POST['achievements']; $sponsors = $_POST['sponsors']; $email = $_POST['email']; $imgName = $_FILES['fleImage']['name']; $tmpName = $_FILES['fleImage']['tmp_name']; // we need to rename the image name just to avoid // duplicate file names // first get the file extension $ext = strrchr($imgName, "."); // then create a new random name $newName = md5(rand() * time()) . $ext; // the album image will be saved here $imgPath = GALLERY_IMG_DIR . $newName; // resize all album image $result = createThumbnail($tmpName, $imgPath, THUMBNAIL_WIDTH); if (!$result) { echo "Error uploading file"; exit; } if (!get_magic_quotes_gpc()) { $name = addslashes($name); $location = addslashes($location); $date_of_birth = addslashes($date_of_birth); $car_number = addslashes($car_number); $favourite_track = addslashes($favourite_track); $least_favourite_track = addslashes($least_favourite_track); $achievements = addslashes($achievements); $sponsors = addslashes($sponsors); $email = addslashes($email); } $query = "INSERT INTO driversnew (id, name, location, date_of_birth, car_number, favourite_track, least_favourite_track, achievements, sponsors, email, image) VALUES ('', '$name','location','date_of_birth','car_number','favourite_track','least_favourite_track','achievements','sponsors','email','$newName')"; mysql_query($query) or die('Error, add album failed : ' . mysql_error()); // the album is saved, go to the album list echo "<script>window.location.href='index.php?page=list-album';</script>"; exit; } ?> PHP:
Hi, I can already see why there is nothing added to the database: query = "INSERT INTO driversnew (id, name, location, date_of_birth, car_number, favourite_track, least_favourite_track, achievements, sponsors, email, image) VALUES ('', '$name','location','date_of_birth','car_number','favourite_track','least_favourite_track','achievements','sponsors','email','$newName')"; Code (markup): Should be query = "INSERT INTO driversnew (id, name, location, date_of_birth, car_number, favourite_track, least_favourite_track, achievements, sponsors, email, image) VALUES ('', '$name','$location','$date_of_birth','$car_number','$favourite_track','$least_favourite_track','$achievements','$sponsors','$email','$newName')"; Code (markup): For the other error, I cannot say it is obvious aXe