Ho letto le guide ma dato che ho già un modulo mi è complicato e scomodo inserirne un'altro staccato che richiami l'upload.php
Avevo quindi pernsato che se modifico il mio codice php della pagina potrei inserire le immagini..
I campi sono 6(prima erano 5) e il codice(quello che riguarda le 5 tabelle e quindi nn quella nuova)è il seguente:
codice:
<?php require_once('../Connections/connblog.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"] == "inseriscimsg")) {
$insertSQL = sprintf("INSERT INTO tblmessaggi (titolo, testo, `data`, autore) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['titolo'], "text"),
GetSQLValueString($_POST['testo'], "text"),
GetSQLValueString($_POST['data'], "text"),
GetSQLValueString($_POST['autore'], "text"));
mysql_select_db($database_connblog, $connblog);
$Result1 = mysql_query($insertSQL, $connblog) or die(mysql_error());
$insertGoTo = "grazie.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_connblog, $connblog);
$query_Recordset1 = "SELECT * FROM tblmessaggi ORDER BY id DESC";
$Recordset1 = mysql_query($query_Recordset1, $connblog) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$pass = $_POST['password'];
if ($pass != "derby") // settare qui la password
{
Header ("Location: accedi.php");
exit;
}
?>
Vedi come nel campo dei GetSQL ci siano solo 5 campi anzichè 6...image_path nn c'è...
mi aiutate a correggere il codice?