in pratica devo inserire una data tramite una text nel db.
il punto è che, come saprete, mysql inserire le date nel formato YYYY/MM/GG; a me servirebbe GG/MM/YYYY.
vi posto il codice:
come posso fare???codice:<?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")) { $insertSQL = sprintf("INSERT INTO partite (`data`, orario, Scasa, Sospite, serie, risCasa, risOspite, descrizione) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['data'], "date"), GetSQLValueString($_POST['orario'], "text"), GetSQLValueString($_POST['Scasa'], "int"), GetSQLValueString($_POST['Sospite'], "int"), GetSQLValueString($_POST['serie'], "text"), GetSQLValueString($_POST['risCasa'], "int"), GetSQLValueString($_POST['risOspite'], "int"), GetSQLValueString($_POST['descrizione'], "text")); mysql_select_db($database_calcio, $calcio); $Result1 = mysql_query($insertSQL, $calcio) or die(mysql_error()); } mysql_select_db($database_calcio, $calcio); $query_ADDpartita = "SELECT * FROM partite"; $ADDpartita = mysql_query($query_ADDpartita, $calcio) or die(mysql_error()); $row_ADDpartita = mysql_fetch_assoc($ADDpartita); $totalRows_ADDpartita = mysql_num_rows($ADDpartita); mysql_select_db($database_calcio, $calcio); $query_extract_squadra = "SELECT * FROM squadre"; $extract_squadra = mysql_query($query_extract_squadra, $calcio) or die(mysql_error()); $row_extract_squadra = mysql_fetch_assoc($extract_squadra); $totalRows_extract_squadra = mysql_num_rows($extract_squadra); ?>

Rispondi quotando