为什么我不能把这两个剧本结合起来呢


Why cant I combine these two scripts

我有这两个脚本。一个是mysql INSERT INTODATABASE

第二个创建了一个新目录,并将多达5张图像上传到新创建的文件夹中。

它们都作为单独的实体工作,但当我尝试将它们组合时,它不会将信息插入数据库。一定有什么矛盾,我就是看不见。

以下是有效的上传文件代码:

<?php

// Assigning $_POSTS to variables

//login details
$username_entry = $_POST['username_entry'];
$password_entry = $_POST['password_entry'];
//!login details
//contact details
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$tel = $_POST['tel'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$address3 = $_POST['address3'];
$address4 = $_POST['address4'];
$postcode = $_POST['postcode'];
$facebook = $_POST['facebook'];
$twitter = $_POST['twitter'];
$whatareyou = $_POST['whatareyou'];
$business_description = $_POST['business_description'];
$website = $_POST['website'];
//!contact details
//opening times
$opening_monday_from = $_POST ['opening_monday_from'];
$opening_monday_to = $_POST ['opening_monday_to'];
$opening_tuesday_from = $_POST ['opening_tuesday_from'];
$opening_tuesday_to = $_POST ['opening_tuesday_to'];
$opening_wednesday_from = $_POST ['opening_wednesday_from'];
$opening_wednesday_to = $_POST ['opening_wednesday_to'];
$opening_thursday_from = $_POST ['opening_thursday_from'];
$opening_thursday_to = $_POST ['opening_thursday_to'];
$opening_friday_from = $_POST ['opening_friday_from'];
$opening_friday_to = $_POST ['opening_friday_to'];
$opening_saturday_from = $_POST ['opening_saturday_from'];
$opening_saturday_to = $_POST ['opening_saturday_to'];
$opening_sunday_from = $_POST ['opening_sunday_from'];
$opening_sunday_to = $_POST ['opening_sunday_to'];

//!opening times

// !Assigning $_POSTS to varaiables
// DataBase credentials
$user = 'root';
$password = 'root';
$db = 'welcometowarwick';
$host = 'localhost';
$port = 8889;
//! DataBase credentials
// Connect to DataBase
$link = mysqli_init();
$success = mysqli_real_connect(
   $link, 
   $host, 
   $user, 
   $password, 
   $db,
   $port
);
//! Connect to DataBase

$directoryPath = "user_images/".$username_entry;
mkdir($directoryPath, 0777, true);

if (isset($_FILES['upload']) === true) {
  $files = $_FILES['upload'];
  for($x = 0; $x < count($files['name']); $x++) {
    $name = $files['name'][$x];
    $tmp_name = $files['tmp_name'][$x];
    move_uploaded_file($tmp_name, "user_images/{$username_entry}/{$name}");
  //echo '<pre>', print_r($files['name'][0], true), '</pre>';
    $image_upload1 = ($files['name'][0]);
    $image_upload2 = ($files['name'][1]);
    $image_upload3 = ($files['name'][2]);
    $image_upload4 = ($files['name'][3]);
    $image_upload5 = ($files['name'][4]);
  }

  $insert_upload1 = "user_images/$username_entry/$image_upload1";
  $insert_upload2 = "user_images/$username_entry/$image_upload2";
  $insert_upload3 = "user_images/$username_entry/$image_upload3";
  $insert_upload4 = "user_images/$username_entry/$image_upload4";
  $insert_upload5 = "user_images/$username_entry/$image_upload5";
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

  $insertSQL = sprintf("INSERT INTO ofnissenisub321 (timestamp, username, password, business_name, address1, address2, address3, postcode, email, website, Facebook, twitter, linkedin, opening_monday_from, opening_monday_to, opening_tuesday_from, opening_tuesday_to, opening_wednesday_from, opening_wednesday_to, opening_thursday_from, opening_friday_from, opening_friday_to, opening_saturday_from, opening_saturday_from, opening_saturday_to, opening_sunday_from, opening_sunday_to, business_type, business_description, managers_message, image_1, image_2, image_3, image_4, image_5) VALUES (NOW(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['username_entry'], "text"),
                       GetSQLValueString($_POST['password_entry'], "text"),
                       GetSQLValueString($_POST['business_name'], "text"),
                       GetSQLValueString($_POST['address1'], "text"),
                       GetSQLValueString($_POST['address2'], "text"),
                       GetSQLValueString($_POST['address3'], "text"),
                       GetSQLValueString($_POST['postcode'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['website'], "text"),
                       GetSQLValueString($_POST['facebook'], "text"),
                       GetSQLValueString($_POST['twitter'], "text"),
                       GetSQLValueString($_POST['linkedin'], "text"),
                       GetSQLValueString($_POST['opening_monday_from'], "text"),
                       GetSQLValueString($_POST['opening_monday_to'], "text"),
                       GetSQLValueString($_POST['opening_tuesday_from'], "text"),
                       GetSQLValueString($_POST['opening_tuesday_to'], "text"),
                       GetSQLValueString($_POST['opening_wednesday_from'], "text"),
                       GetSQLValueString($_POST['opening_wednesday_to'], "text"),
                       GetSQLValueString($_POST['opening_thursday_from'], "text"),
                       GetSQLValueString($_POST['opening_thursday_to'], "text"),
                       GetSQLValueString($_POST['opening_friday_from'], "text"),
                       GetSQLValueString($_POST['opening_friday_to'], "text"),
                       GetSQLValueString($_POST['opening_saturday_from'], "text"),
                       GetSQLValueString($_POST['opening_saturday_to'], "text"),
                       GetSQLValueString($_POST['opening_sunday_from'], "text"),
                       GetSQLValueString($_POST['opening_sunday_to'], "text"),
                       GetSQLValueString($_POST['business_type'], "text"),
                       GetSQLValueString($_POST['business_description'], "text"),
                       GetSQLValueString($_POST['managers_message'], "text"),
             GetSQLValueString($insert_upload1, "text"),
             GetSQLValueString($insert_upload2, "text"),
             GetSQLValueString($insert_upload3, "text"),
             GetSQLValueString($insert_upload4, "text"),
             GetSQLValueString($insert_upload5, "text"));
  mysql_select_db($database_w2w, $w2w);
  $Result1 = mysql_query($insertSQL, $w2w) or die(mysql_error());  }



if (mysqli_query($link, $sql)) {
    echo "New record created successfully $username_entry";
} else {
    echo "Error: " . $sql . "<br>" . mysqli_error($link);
}
mysqli_close($link);
//! MySQLi insertInto
?> 

?>

这是INSERT代码,同样有效:

<?php

// Assigning $_POSTS to variables

//login details
$username_entry = $_POST['username_entry'];
$password_entry = $_POST['password_entry'];
//!login details
//contact details
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$tel = $_POST['tel'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$address3 = $_POST['address3'];
$address4 = $_POST['address4'];
$postcode = $_POST['postcode'];
$facebook = $_POST['facebook'];
$twitter = $_POST['twitter'];
$whatareyou = $_POST['whatareyou'];
$business_description = $_POST['business_description'];
$website = $_POST['website'];
//!contact details
//opening times
$opening_monday_from = $_POST ['opening_monday_from'];
$opening_monday_to = $_POST ['opening_monday_to'];
$opening_tuesday_from = $_POST ['opening_tuesday_from'];
$opening_tuesday_to = $_POST ['opening_tuesday_to'];
$opening_wednesday_from = $_POST ['opening_wednesday_from'];
$opening_wednesday_to = $_POST ['opening_wednesday_to'];
$opening_thursday_from = $_POST ['opening_thursday_from'];
$opening_thursday_to = $_POST ['opening_thursday_to'];
$opening_friday_from = $_POST ['opening_friday_from'];
$opening_friday_to = $_POST ['opening_friday_to'];
$opening_saturday_from = $_POST ['opening_saturday_from'];
$opening_saturday_to = $_POST ['opening_saturday_to'];
$opening_sunday_from = $_POST ['opening_sunday_from'];
$opening_sunday_to = $_POST ['opening_sunday_to'];

//!opening times

// !Assigning $_POSTS to varaiables
// DataBase credentials
$user = 'root';
$password = 'root';
$db = 'welcometowarwick';
$host = 'localhost';
$port = 8889;
//! DataBase credentials
// Connect to DataBase
$link = mysqli_init();
$success = mysqli_real_connect(
   $link, 
   $host, 
   $user, 
   $password, 
   $db,
   $port
);
//! Connect to DataBase


//MySQLi insertInto
$sql = "INSERT INTO business_info 
(
username,
password,
email,
email2,
tel,
address1,
address2,
address3,
address4,
postcode,
facebook,
twitter,
opening_monday_to,
opening_monday_from,
opening_tuesday_to,
opening_tuesday_from,
opening_wednesday_to,
opening_wednesday_from,
opening_thursday_to,
opening_thursday_from,
opening_friday_to,
opening_friday_from,
opening_saturday_to,
opening_saturday_from,
opening_sunday_to,
opening_sunday_from,
whatareyou,
business_description,
image1,
image2,
image3,
image4,
image5,
website

) 
VALUES 
(
'$username_entry',
'$password_entry',
'$email1',
'$email2',
'$tel', 
'$address1',
'$address2',
'$address3',
'$address4',
'$postcode',
'$facebook',
'$twitter',
'$opening_monday_to',
'$opening_monday_from',
'$opening_tuesday_to',
'$opening_tuesday_from',
'$opening_wednesday_to',
'$opening_wednesday_from',
'$opening_thursday_to',
'$opening_thursday_from',
'$opening_friday_to',
'$opening_friday_from',
'$opening_saturday_to',
'$opening_saturday_from',
'$opening_sunday_to',
'$opening_sunday_from',
'$whatareyou',
'$business_description',
'$image1',
'$image2',
'$image3',
'$image4',
'$image5',
'$website'
)";

if (mysqli_query($link, $sql)) {
    echo "New record created successfully $username_entry";
} else {
    echo "Error: " . $sql . "<br>" . mysqli_error($link);
}
mysqli_close($link);
//! MySQLi insertInto
?> 

我尝试过这两种代码的不同组合(这就是为什么UPLOAD脚本中有不重要的位。然而,两者都是单独测试的,都能完成所需的工作。我只是无法让它们同时运行。

有人能解释一下吗。谢谢:)

基本上,我只想在不中断的情况下将mkdir上传脚本添加到INSERT脚本中…

******编辑这里是我无法制作的脚本******

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
// Assigning $_POSTS to variables

//login details
$username_entry = $_POST['username_entry'];
$password_entry = $_POST['password_entry'];
//!login details
//contact details
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$tel = $_POST['tel'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$address3 = $_POST['address3'];
$address4 = $_POST['address4'];
$postcode = $_POST['postcode'];
$facebook = $_POST['facebook'];
$twitter = $_POST['twitter'];
$whatareyou = $_POST['whatareyou'];
$business_description = $_POST['business_description'];
$website = $_POST['website'];
//!contact details
//opening times
$opening_monday_from = $_POST ['opening_monday_from'];
$opening_monday_to = $_POST ['opening_monday_to'];
$opening_tuesday_from = $_POST ['opening_tuesday_from'];
$opening_tuesday_to = $_POST ['opening_tuesday_to'];
$opening_wednesday_from = $_POST ['opening_wednesday_from'];
$opening_wednesday_to = $_POST ['opening_wednesday_to'];
$opening_thursday_from = $_POST ['opening_thursday_from'];
$opening_thursday_to = $_POST ['opening_thursday_to'];
$opening_friday_from = $_POST ['opening_friday_from'];
$opening_friday_to = $_POST ['opening_friday_to'];
$opening_saturday_from = $_POST ['opening_saturday_from'];
$opening_saturday_to = $_POST ['opening_saturday_to'];
$opening_sunday_from = $_POST ['opening_sunday_from'];
$opening_sunday_to = $_POST ['opening_sunday_to'];

//!opening times

// !Assigning $_POSTS to varaiables
// DataBase credentials
$user = 'root';
$password = 'root';
$db = 'welcometowarwick';
$host = 'localhost';
$port = 8889;
//! DataBase credentials
// Connect to DataBase
$link = mysqli_init();
$success = mysqli_real_connect(
   $link, 
   $host, 
   $user, 
   $password, 
   $db,
   $port
);
//! Connect to DataBase

$directoryPath = "user_images/".$username_entry;
mkdir($directoryPath, 0777, true);

if (isset($_FILES['upload']) === true) {
  $files = $_FILES['upload'];
  for($x = 0; $x < count($files['name']); $x++) {
    $name = $files['name'][$x];
    $tmp_name = $files['tmp_name'][$x];
    move_uploaded_file($tmp_name, "user_images/{$username_entry}/{$name}");
  //echo '<pre>', print_r($files['name'][0], true), '</pre>';
    $image_upload1 = ($files['name'][0]);
    $image_upload2 = ($files['name'][1]);
    $image_upload3 = ($files['name'][2]);
    $image_upload4 = ($files['name'][3]);
    $image_upload5 = ($files['name'][4]);
  }

  $insert_upload1 = "user_images/$username_entry/$image_upload1";
  $insert_upload2 = "user_images/$username_entry/$image_upload2";
  $insert_upload3 = "user_images/$username_entry/$image_upload3";
  $insert_upload4 = "user_images/$username_entry/$image_upload4";
  $insert_upload5 = "user_images/$username_entry/$image_upload5";
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

  $insertSQL = sprintf("INSERT INTO ofnissenisub321 (timestamp, username, password, business_name, address1, address2, address3, postcode, email, website, Facebook, twitter, linkedin, opening_monday_from, opening_monday_to, opening_tuesday_from, opening_tuesday_to, opening_wednesday_from, opening_wednesday_to, opening_thursday_from, opening_friday_from, opening_friday_to, opening_saturday_from, opening_saturday_from, opening_saturday_to, opening_sunday_from, opening_sunday_to, business_type, business_description, managers_message, image_1, image_2, image_3, image_4, image_5) VALUES (NOW(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['username_entry'], "text"),
                       GetSQLValueString($_POST['password_entry'], "text"),
                       GetSQLValueString($_POST['business_name'], "text"),
                       GetSQLValueString($_POST['address1'], "text"),
                       GetSQLValueString($_POST['address2'], "text"),
                       GetSQLValueString($_POST['address3'], "text"),
                       GetSQLValueString($_POST['postcode'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['website'], "text"),
                       GetSQLValueString($_POST['facebook'], "text"),
                       GetSQLValueString($_POST['twitter'], "text"),
                       GetSQLValueString($_POST['linkedin'], "text"),
                       GetSQLValueString($_POST['opening_monday_from'], "text"),
                       GetSQLValueString($_POST['opening_monday_to'], "text"),
                       GetSQLValueString($_POST['opening_tuesday_from'], "text"),
                       GetSQLValueString($_POST['opening_tuesday_to'], "text"),
                       GetSQLValueString($_POST['opening_wednesday_from'], "text"),
                       GetSQLValueString($_POST['opening_wednesday_to'], "text"),
                       GetSQLValueString($_POST['opening_thursday_from'], "text"),
                       GetSQLValueString($_POST['opening_thursday_to'], "text"),
                       GetSQLValueString($_POST['opening_friday_from'], "text"),
                       GetSQLValueString($_POST['opening_friday_to'], "text"),
                       GetSQLValueString($_POST['opening_saturday_from'], "text"),
                       GetSQLValueString($_POST['opening_saturday_to'], "text"),
                       GetSQLValueString($_POST['opening_sunday_from'], "text"),
                       GetSQLValueString($_POST['opening_sunday_to'], "text"),
                       GetSQLValueString($_POST['business_type'], "text"),
                       GetSQLValueString($_POST['business_description'], "text"),
                       GetSQLValueString($_POST['managers_message'], "text"),
             GetSQLValueString($insert_upload1, "text"),
             GetSQLValueString($insert_upload2, "text"),
             GetSQLValueString($insert_upload3, "text"),
             GetSQLValueString($insert_upload4, "text"),
             GetSQLValueString($insert_upload5, "text"));
  mysql_select_db($success, $insertSQL);
  $Result1 = mysql_query($insertSQL, $link) or die(mysql_error());  }



if (mysqli_query($link, $sql)) {
    echo "New record created successfully $username_entry";
} else {
    echo "Error: " . $sql . "<br>" . mysqli_error($link);
}
mysqli_close($link);
//! MySQLi insertInto
?> 

?>

没有我想要的那么干净,但我建议您尝试重写代码:

<?php 
// Comment in production
ini_set('display_errors', 1); 
error_reporting(E_ALL);
// DataBase credentials & connection
$user = 'root';
$password = 'root';
$db = 'welcometowarwick';
$host = 'localhost';
$port = 8889;

$link = mysqli_connect(
    $host,
    $user,
    $password,
    $db,
    $port
);

if (!$link) {
    die('DB connection error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
mysqli_select_db($link, $db);

## Functions

if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
        global $link;
        if (PHP_VERSION < 6) {
            $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
        }
        $theValue = mysqli_real_escape_string($link, $theValue);
        switch ($theType) {
            case "text":
                $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                break;
            case "long":
            case "int":
                $theValue = ($theValue != "") ? intval($theValue) : "NULL";
                break;
            case "double":
                $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
                break;
            case "date":
                $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
                break;
            case "defined":
                $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
                break;
        }
        return $theValue;
    }
}

$username_entry = $_POST['username_entry'];
if (empty($_POST['username_entry'])) {
    die('Username must be given');
}
$user_image_dir = "user_images";

mkdir($user_image_dir."/".$username_entry, 0777, true);

if (isset($_FILES['upload']) === true) {
    $files = $_FILES['upload']; 
    for($x = 0; $x < count($files['name']); $x++) { 
        $name = $files['name'][$x]; 
        $tmp_name = $files['tmp_name'][$x]; 
        move_uploaded_file($tmp_name, "$user_image_dir/{$username_entry}/{$name}"); 
        //echo '<pre>', print_r($files['name'][0], true), '</pre>'; 
        $image_upload1 = ($files['name'][0]); 
        $image_upload2 = ($files['name'][1]); 
        $image_upload3 = ($files['name'][2]); 
        $image_upload4 = ($files['name'][3]); 
        $image_upload5 = ($files['name'][4]); 
    }

    $insert_upload1 = "$user_image_dir/$username_entry/$image_upload1"; 
    $insert_upload2 = "$user_image_dir/$username_entry/$image_upload2"; 
    $insert_upload3 = "$user_image_dir/$username_entry/$image_upload3"; 
    $insert_upload4 = "$user_image_dir/$username_entry/$image_upload4"; 
    $insert_upload5 = "$user_image_dir/$username_entry/$image_upload5"; 

    $editFormAction = $_SERVER['PHP_SELF']; 
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); 

    $insertSQL = sprintf("INSERT INTO images (timestamp, username, password, business_name, address1, address2, address3, postcode, email, website, Facebook, twitter, linkedin, opening_monday_from, opening_monday_to, opening_tuesday_from, opening_tuesday_to, opening_wednesday_from, opening_wednesday_to, opening_thursday_from, opening_friday_from, opening_friday_to, opening_saturday_from, opening_saturday_from, opening_saturday_to, opening_sunday_from, opening_sunday_to, business_type, business_description, managers_message, image_1, image_2, image_3, image_4, image_5) VALUES (NOW(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", 
    GetSQLValueString($_POST['username_entry'], "text"), 
    GetSQLValueString($_POST['password_entry'], "text"), 
    GetSQLValueString($_POST['business_name'], "text"), 
    GetSQLValueString($_POST['address1'], "text"), 
    GetSQLValueString($_POST['address2'], "text"), 
    GetSQLValueString($_POST['address3'], "text"), 
    GetSQLValueString($_POST['postcode'], "text"), 
    GetSQLValueString($_POST['email'], "text"), 
    GetSQLValueString($_POST['website'], "text"), 
    GetSQLValueString($_POST['facebook'], "text"), 
    GetSQLValueString($_POST['twitter'], "text"), 
    GetSQLValueString($_POST['linkedin'], "text"), 
    GetSQLValueString($_POST['opening_monday_from'], "text"), 
    GetSQLValueString($_POST['opening_monday_to'], "text"), 
    GetSQLValueString($_POST['opening_tuesday_from'], "text"), 
    GetSQLValueString($_POST['opening_tuesday_to'], "text"), 
    GetSQLValueString($_POST['opening_wednesday_from'], "text"), 
    GetSQLValueString($_POST['opening_wednesday_to'], "text"), 
    GetSQLValueString($_POST['opening_thursday_from'], "text"), 
    GetSQLValueString($_POST['opening_thursday_to'], "text"), 
    GetSQLValueString($_POST['opening_friday_from'], "text"), 
    GetSQLValueString($_POST['opening_friday_to'], "text"), 
    GetSQLValueString($_POST['opening_saturday_from'], "text"), 
    GetSQLValueString($_POST['opening_saturday_to'], "text"), 
    GetSQLValueString($_POST['opening_sunday_from'], "text"), 
    GetSQLValueString($_POST['opening_sunday_to'], "text"), 
    GetSQLValueString($_POST['business_type'], "text"), 
    GetSQLValueString($_POST['business_description'], "text"), 
    GetSQLValueString($_POST['managers_message'], "text"), 
    GetSQLValueString($insert_upload1, "text"), 
    GetSQLValueString($insert_upload2, "text"), 
    GetSQLValueString($insert_upload3, "text"), 
    GetSQLValueString($insert_upload4, "text"), 
    GetSQLValueString($insert_upload5, "text")); 


    if (mysqli_query($link, $insertSQL)) {
        echo "New record created successfully $username_entry";
    } else {
        echo "Error: " . $insertSQL . "<br>" . mysqli_error($link);
    }
    mysqli_close($link);

} else {
    die('no images given, so no insertion in DB');
}

尝试添加:

ini_set('display_errors', 1);
error_reporting(E_ALL);

在你的脚本顶部,给我们错误。