layotfab | Il n'y a rien avant c que du php, je te met le code Et comment explique tu que ca fonctionne sur le serveur mais en local sur apache ca marche pas?
<?php require_once('../../Connections/fab.php'); ?>
Code :
- <?php
- if(isset($_POST['submit'])){
- /*$annee1 = substr($date1, 6, 9);
- $mois1 = substr($date1, 3, 2);
- $jour1 = substr($date1, 0, 2);
- $date1 = $annee1 . '-' . $mois1 . '-' . $jour1;
-
- $annee2 = substr($date2, 6, 9);
- $mois2 = substr($date2, 3, 2);
- $jour2 = substr($date2, 0, 2);
- $date2 = $annee2 . '-' . $mois2 . '-' . $jour2;
- */}
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "" )
- {
- $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
- switch ($theType) {
- case "text":
- $theValue = ($theValue != "" ) ? "'" . $theValue . "'" : "NULL";
- break;
- case "int":
- $theValue = ($theValue != "" ) ? intval($theValue) : "NULL";
- break;
- case "date":
- $theValue = ($theValue != "" ) ? "'" . $theValue . "'" : "NULL";
- 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 agenda (id, texte,titre, date1, date2, choix1, choix2, principal) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
- GetSQLValueString($_POST['id'], "int" ),
- GetSQLValueString($_POST['texte'], "text" ),
- GetSQLValueString($_POST['titre'], "text" ),
- GetSQLValueString($_POST['date1'], "date" ),
- GetSQLValueString($date2, "date" ),
- GetSQLValueString($_POST['choix1'], "text" ),
- GetSQLValueString($_POST['choix2'], "text" ),
- GetSQLValueString($_POST['principal'], "text" ));
- mysql_select_db($database_fab, $fab);
- $Result1 = mysql_query($insertSQL, $fab) or die(mysql_error());
- $insertGoTo = "agenda.php";
- if (isset($_SERVER['QUERY_STRING'])) {
- $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
- $insertGoTo .= $_SERVER['QUERY_STRING'];
- }
- header(sprintf("Location: %s", $insertGoTo));
- }
- mysql_select_db($database_fab, $fab);
- $query_Recordset1 = "SELECT * FROM agenda";
- $Recordset1 = mysql_query($query_Recordset1, $fab) or die(mysql_error());
- $row_Recordset1 = mysql_fetch_assoc($Recordset1);
- $totalRows_Recordset1 = mysql_num_rows($Recordset1);
- ?>
|
|