Salut ,
Je voudrais savoir enregistrer un enregistrement de MYSQL et enregistrer un fichier sur le serveur
(l'enrigistrement de MYSQL est fais avec Dreamweaver MX 2004
////////// Fichier 'Connections/rctte_db.php'////////////////////////////
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_rctte_db = "localhost";
$database_rctte_db = "rctte_db";
$username_rctte_db = "yanndroniou";
$password_rctte_db = "";
$rctte_db = mysql_pconnect($hostname_rctte_db, $username_rctte_db, $password_rctte_db) or trigger_error(mysql_error(),E_USER_ERROR);
?>
///// Fichier ajout.php ////////////////////////////
<?php require_once('Connections/rctte_db.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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")) {
$insertSQL = sprintf("INSERT INTO voies (nom, style, comment, file) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['atrac'], "text"),
GetSQLValueString($_POST['comm'], "text"),
GetSQLValueString($_POST['Fichier'], "text"));
mysql_select_db($database_rctte_db, $rctte_db);
$Result1 = mysql_query($insertSQL, $rctte_db) or die(mysql_error());
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_rctte_db, $rctte_db);
$query_Recordset1 = "SELECT * FROM voies";
$Recordset1 = mysql_query($query_Recordset1, $rctte_db) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<form name="form1" enctype="multipart/form-data" method="POST" action="<?php echo $editFormAction; ?>">
<p>
<input type="file" name="Fichier" onChange="goer(this.value)">
</p>
<p>
<input name="nom" type="text" id="nom">
</p>
<p>
<select name="atrac" id="atrac">
<option value="1" selected>1</option>
<option value="2">2</option>
</select>
</p>
<p>
<textarea name="comm" id="comm"></textarea>
<input type="submit" name="Submit" value="Envoyer">
</p>
<input type="hidden" name="MM_insert" value="form1">
</form>
<?php
mysql_free_result($Recordset1);
?>
enfaite je ve savoir où on place la fonction pour enregistrer le fichier et comment faire.
Je suis débutant, Merci de me répondre.

Yann Droniou
