A voir également:
- Plusieurs photos
- Partage de photos - Guide
- Mes photos google - Guide
- Publication instagram plusieurs photos - Guide
- Doublons photos - Guide
- Google photos - Télécharger - Albums photo
1 réponse
petites précision ça c'est la partie modif, la partie ajout c'est :
<?php
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'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
if($_FILES['photoun']['photodeux']['phototrois']['photoquatre']['error']==0)
{
//copie de la photo dans le répertoire /photos/
copy($_FILES['photoun']['photodeux']['phototrois']['photoquatre']['tmp_name'],"../photos/".$_FILES['photoun']['photodeux']['phototrois']['photoquatre']['name']);
//enregistrement des informations AVEC le nom de la photo
$insertSQL = sprintf("INSERT INTO categories (reference, categorie, nom, accroche, 'description', prix, photoun, photodeux, phototrois, photoquatre) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['reference'], "text"),
GetSQLValueString($_POST['categorie'], "text"),
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['accroche'], "text"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['prix'], "text"),
GetSQLValueString($_FILES['photoun']['name'], "text"),
GetSQLValueString($_FILES['photodeux']['name'], "text"),
GetSQLValueString($_FILES['phototrois']['name'], "text"),
GetSQLValueString($_FILES['photoquatre']['name'], "text"));
}else{
//enregistrement des informations SANS le nom de la photo
$insertSQL = sprintf("INSERT INTO categories (reference, categorie, nom, accroche, 'description', prix) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['reference'], "text"),
GetSQLValueString($_POST['categorie'], "text"),
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['accroche'], "text"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['prix'], "text"));
}
mysql_select_db($database_maConnexion, $maConnexion);
$Result1 = mysql_query($insertSQL, $maConnexion) or die(mysql_error());
$insertGoTo = "categoriesGestion.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_maConnexion, $maConnexion);
$query_rscategories = "SELECT * FROM categories";
$rscategories = mysql_query($query_rscategories, $maConnexion) or die(mysql_error());
$row_rscategories = mysql_fetch_assoc($rscategories);
$totalRows_rscategories = mysql_num_rows($rscategories);
?>
<?php
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'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
if($_FILES['photoun']['photodeux']['phototrois']['photoquatre']['error']==0)
{
//copie de la photo dans le répertoire /photos/
copy($_FILES['photoun']['photodeux']['phototrois']['photoquatre']['tmp_name'],"../photos/".$_FILES['photoun']['photodeux']['phototrois']['photoquatre']['name']);
//enregistrement des informations AVEC le nom de la photo
$insertSQL = sprintf("INSERT INTO categories (reference, categorie, nom, accroche, 'description', prix, photoun, photodeux, phototrois, photoquatre) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['reference'], "text"),
GetSQLValueString($_POST['categorie'], "text"),
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['accroche'], "text"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['prix'], "text"),
GetSQLValueString($_FILES['photoun']['name'], "text"),
GetSQLValueString($_FILES['photodeux']['name'], "text"),
GetSQLValueString($_FILES['phototrois']['name'], "text"),
GetSQLValueString($_FILES['photoquatre']['name'], "text"));
}else{
//enregistrement des informations SANS le nom de la photo
$insertSQL = sprintf("INSERT INTO categories (reference, categorie, nom, accroche, 'description', prix) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['reference'], "text"),
GetSQLValueString($_POST['categorie'], "text"),
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['accroche'], "text"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['prix'], "text"));
}
mysql_select_db($database_maConnexion, $maConnexion);
$Result1 = mysql_query($insertSQL, $maConnexion) or die(mysql_error());
$insertGoTo = "categoriesGestion.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_maConnexion, $maConnexion);
$query_rscategories = "SELECT * FROM categories";
$rscategories = mysql_query($query_rscategories, $maConnexion) or die(mysql_error());
$row_rscategories = mysql_fetch_assoc($rscategories);
$totalRows_rscategories = mysql_num_rows($rscategories);
?>