2015-03-23 2 views
0

У меня есть два сценария. Один из них - mysql INSERT INTO a DATABASE.Почему я не могу объединить эти два сценария

Вторая создала новый каталог и загрузила до 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 сценарий, не нарушая его ....

****** EDIT ВОТ SCRIPT Я НЕ МОГУ СДЕЛАТЬ РАБОТУ *** ***

<?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 
?> 


?> 
+0

Можете ли вы показать нам ваши вместе взятые? Были ли ошибки? –

+0

По сути, это сценарий UPLOAD, он имеет все установленные vars и все вставки в нем, но он просто не работает при использовании в сочетании с mkdir и upload. Я добавил INSERT сам по себе, чтобы показать, что это работает отлично, хотя это немного отличается, я не могу понять, почему он не работает ... Он просто показывает пустой экран. Нет ошибок. –

ответ

0

не так чисто, как я хочу, но я предлагаю вам попробовать это переписывание кода:

<?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'); 
} 
0

Попробуйте добавить:

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

в верхней части вашего сценария и дать нам эту ошибку.

+0

Предупреждение: mkdir(): Файл существует в /Applications/MAMP/htdocs/welcometowarwick/con.php в строке 92 –

+0

Предупреждение: mysql_select_db() ожидает, что параметр 2 будет ресурсом, объект указан в/Applications/MAMP/htdocs/welcometowarwick/con.php на линии 194 Устаревшие: mysql_real_escape_string(): расширение MySQL является устаревшим и будет удален в будущем: использование MySQLi или PDO вместо того, чтобы в /Applications/MAMP/htdocs/welcometowarwick/con.php на линии 129 Предупреждение: mysql_query() ожидает, что параметр 2 будет ресурсом, объект указан в /Applications/MAMP/htdocs/welcometowarwick/con.php в строке 195 –

+0

любые мысли? ... –

Смежные вопросы