Voilà mon souci, mon programme, doit retourner à la BDD un titre, un texte, une illustration, un nom de lien (namelocal) et une arborescence vers un fichier (local).
Mon problème est que le titre texte et illustration ont une ID et namelocal et local en ont une autre.
voilà mon code.
<html>
<head>
<link rel="stylesheet" type="text/css" href="../styles.css">
</head>
<body>
<?php
include ('../connectionadmin.php');
$namelocal=trim($_POST['namelocal']);
$description=$_POST['description'];
$local=$_POST['local'];
$mere=$_POST['mere'];
$diffusion=$_POST['diffusion'];
$local=str_replace("\\","/",$local);
$local=str_replace("'","%27",$local);
$local=str_replace("Z:/wamp/www/gedv2/","",$local);
$title=trim($_POST['title']);
$text=trim($_POST['text']);
$illustr=$_POST['illustr'];
if (!empty($title)||!empty($text))
{
$sql="INSERT INTO `contain` ( `id` , `title`, `text` , `illustr`, `date` ) VALUES (NULL , '".ucfirst($title)."', '".ucfirst($text)."', '".$illustr."', NULL)";
$resultat=@mysql_db_query($dbname,$sql,$id_link);
echo ucfirst($titre)." ajouté";
}
else {echo "Saisissez un titre et/ou un texte";}
if(!empty($local))
{
$sql="INSERT INTO `contain` ( `id` , `namelocal`, `local`) VALUES (NULL , '".$namelocal."', '".$local."')";
$resultat=@mysql_db_query($dbname,$sql,$id_link);
$UID=@mysql_insert_id();
$i=0;
while ($result=$mere[$i])
{
$result=explode(',',$result);
$sql="INSERT INTO `liens` ( `id` , `idfile` , `ncat` , `cat` ) VALUES (NULL , '".$UID."', '".$result[0]."', '".$result[1]."')";
$resultat=@mysql_db_query($dbname,$sql,$id_link);
$i++;
}
echo "Fichier ".$fichier." ajouté.";
}
else {echo "Renseignez le nom, la/les catégorie(s) et le document SVP.";}
?>
</body></html>
Qelqu'un aurait une idée pour moi ? merci d'avance !
