Jump to content

Recommended Posts

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.";
}
}
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/121325-whats-wrong/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625518
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625546
Share on other sites

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());

Link to comment
https://forums.phpfreaks.com/topic/121325-whats-wrong/#findComment-625547
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.