techker Posted August 26, 2008 Share Posted August 26, 2008 hey guythis script was working fine yesturday and now..nothing.. it insert data from a form in my mysql db can sombody see if they can see a mistake in here..cause i played arround with it..lol <?php $target = "./"; $target2= "./"; $target3= "./"; $target = $target . basename( $_FILES['photo']['name']); $target2 = $target2 . basename( $_FILES['thumb']['name']); $target3 = $target3 . basename( $_FILES['pics']['name']); $target4 = $target4 . basename( $_FILES['pics2']['name']); $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $pic=($_FILES['photo']['name']); $thumb=($_FILES['thumb']['name']); $num=$_POST['numero']; $desc=$_POST['description']; $pics=($_FILES['pics']['name']); $pics2=($_FILES['pics2']['name']); $kilo=$_POST['kilometers']; $year=$_POST['year']; // Connects to your Database mysql_connect("localhost", "canadaau_", "") or die(mysql_error()) ; mysql_select_db("canadaau_") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic','$num','$desc','$thumb','$pics','$pics2','$kilo','$year')") ; if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { if(move_uploaded_file($_FILES['thumb']['tmp_name'], $target2)) { if(move_uploaded_file($_FILES['pics']['tmp_name'], $target3)) { if(move_uploaded_file($_FILES['pics2']['tmp_name'], $target4)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; echo "You'll be redirected to Home Page after (4) Seconds"; echo "<meta http-equiv=Refresh content=4;url=/ADMIN/index_cpanel.php>"; } else { echo "Sorry, there was a problem uploading your file."; } } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/ Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 Any umm...errors? Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625512 Share on other sites More sharing options...
techker Posted August 26, 2008 Author Share Posted August 26, 2008 no thai is the messt up part..it redirects me when afther it is done like usal? Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625516 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 Try changing: mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic','$num','$desc','$thumb','$pics','$pics2','$kilo','$year')") ; To: mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic','$num','$desc','$thumb','$pics','$pics2','$kilo','$year')") OR die(mysql_error()); Tell me if there's any errors. Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625518 Share on other sites More sharing options...
techker Posted August 26, 2008 Author Share Posted August 26, 2008 hmm Parse error: syntax error, unexpected T_STRING in /home/canadaau/public_html/ADMIN/pics/add2.php on line 28 it is that same line.. Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625523 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 I didn't get any errors: nick:~$ php -l <?php mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic','$num','$desc','$thumb','$pics','$pics2','$kilo','$year')") OR die(mysql_error()); ?> No syntax errors detected in - Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625530 Share on other sites More sharing options...
techker Posted August 26, 2008 Author Share Posted August 26, 2008 ?what do you mean? Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625535 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 I just tried the line and got no syntax errors. Can I see your full code with the updated line? Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625537 Share on other sites More sharing options...
techker Posted August 26, 2008 Author Share Posted August 26, 2008 you know what i think i know,i got an email last week from my hosting company saying that they will put register globals off. can it be that?i will try another way and see. Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625541 Share on other sites More sharing options...
techker Posted August 26, 2008 Author Share Posted August 26, 2008 ok so i change it to mysql_query("INSERT INTO `employees`( name, email,phone,photo,thumb,numero,description,pics,pics2,kilometers,year) VALUES ('$name', '$email','$phone','$pic','$thumb','$num','$desc','$pics','$pics2','$kilo','$year')") ; mysql_query($query) or die('Error, add album failed : ' . mysql_error()); and get Error, add album failed : Query was empty Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625546 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 You never set $query...Try: $query = "INSERT INTO `employees`( name, email,phone,photo,thumb,numero,description,pics,pics2,kilometers,year) VALUES ('$name', '$email','$phone','$pic','$thumb','$num','$desc','$pics','$pics2','$kilo','$year')"; mysql_query($query) or die('Error, add album failed : ' . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625547 Share on other sites More sharing options...
techker Posted August 26, 2008 Author Share Posted August 26, 2008 aha!thx dude what i don't understant it was working yesthurday..lol anyways fixed and works! Quote Link to comment https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625560 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.