daniel5455 Posted August 30, 2008 Share Posted August 30, 2008 I have a page where i can add products and for some reason when i fill out the information and press add product i dont see the data in the database. I get "The product added successfully" on the screen. I can delete the products but not create them so that should tell me the user info is correct. I did verify the user account and it has full privs. <?php require_once($_SERVER[DOCUMENT_ROOT] . "/includes/config.php"); ?> <?php session_start(); if(!isset($_SESSION["userid"]) || !isset($_SESSION["usertype"]) ) { echo "<script>document.location='login.php';</script>"; header( 'Location: login.php' ) ; } else { if($_SESSION["usertype"] != "admin") { echo "<script>document.location='login.php';</script>"; header( 'Location: login.php' ) ; } } if ((($_FILES["image"]["type"] == "image/gif")|| ($_FILES["image"]["type"] == "image/jpeg")|| ($_FILES["image"]["type"] == "image/pjpeg")|| ($_FILES["image"]["type"] == "image/jpg")|| ($_FILES["image"]["type"] == "image/bmp")|| ($_FILES["image"]["type"] == "image/png"))&& ($_FILES["image"]["size"] < 5000000)) { $target_path = "./productimages/"; $target_path = $target_path . basename( $_FILES['image']['name']); $title=$_POST['title']; $item=$_POST['item']; $price=$_POST['price']; $processor=$_POST['processor']; $image=$_FILES['image']['name']; $memory=$_POST['memory']; $hdd=$_POST['hdd']; $cdrom=$_POST['cdrom']; $display=$_POST['display']; $other=$_POST['other']; $os=$_POST['os']; $warranty=$_POST['warranty']; $type=$_POST['type']; $make=$_POST['make']; if(!move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) { echo "<span style='color:green'> Image could not be copied <br></span>"; } // mysql_query("INSERT INTO product (title,item,price,processor,image,memory,hdd,cdrom,display,other,os,warranty,type,make) VALUES ('$title','$item','$price','$processor','$image','$memory','$hdd','$cdrom','$display','$other','$os','$warranty','$type','$make')"); mysql_query("INSERT INTO `product` (`id` , `title` , `item` , `price` , `processor` , `image` , `memory` , `hdd` , `cdrom`, `display` , `other` , `os` , `warranty` , `type` , `make`) VALUES (NULL, '$title','$item','$price','$processor','$image','$memory','$hdd','$cdrom','$display','$other','$os','$warranty','$type','$make')"); echo "<span style='color:green'> The product added successfully </span>"; } else echo "<span style='color:green'> File is not supported or size is too large </span>"; ?> Link to comment https://forums.phpfreaks.com/topic/122044-solved-not-entering-into-database/ Share on other sites More sharing options...
pocobueno1388 Posted August 30, 2008 Share Posted August 30, 2008 Add a die error to the end of your query mysql_query("INSERT INTO `product` (`id` , `title` , `item` , `price` , `processor` , `image` , `memory` , `hdd` , `cdrom`, `display` , `other` , `os` , `warranty` , `type` , `make`) VALUES (NULL, '$title','$item','$price','$processor','$image','$memory','$hdd','$cdrom','$display','$other','$os','$warranty','$type','$make')")or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/122044-solved-not-entering-into-database/#findComment-630014 Share on other sites More sharing options...
daniel5455 Posted August 30, 2008 Author Share Posted August 30, 2008 Thanks for the reply i did that and got this message when trying to add something Unknown column 'type' in 'field list' what does this mean? Link to comment https://forums.phpfreaks.com/topic/122044-solved-not-entering-into-database/#findComment-630016 Share on other sites More sharing options...
DarkWater Posted August 30, 2008 Share Posted August 30, 2008 There's no column named "type" in your database? >_> Link to comment https://forums.phpfreaks.com/topic/122044-solved-not-entering-into-database/#findComment-630019 Share on other sites More sharing options...
daniel5455 Posted August 30, 2008 Author Share Posted August 30, 2008 genius . thanks alot for the help. Link to comment https://forums.phpfreaks.com/topic/122044-solved-not-entering-into-database/#findComment-630023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.