Bonjour à tous, J'ai un probleme avec la fonction mysqli en connectant à la bd et voici mon code pour l'insertion :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
include("fonctions.php");
ini_set('display_errors','on');
error_reporting(E_ALL);
$a=76/1;
?>
<html><head><link  rel="stylesheet" type="text/css" href="style.css"/><title>Stckage des données تخزين المعطيات</title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/></head>
<body bgcolor="#911ff1"><H2>
<pre><?php
//header('Content-Type: text/html; charset=UTF-8'); 
if (isset($_POST['Submit'])) {
 $name=$_POST['name']; 
 $email=$_POST['email'];
 $tel=$_POST['tel'];  
 $objetp=$_POST['objetp'];
 $description=$_POST['description'];         
 
 
if ( empty($name) ) {
    die("<center>Vous devez écrire votre nom-يجب أن تكتبوا إسمكم");
 
}
if((empty($_POST['email']))) {  
         echo $_POST['email'];  
      }
 
else if ( 1 < (strlen($_POST['email']) < 5) || (strlen($_POST['email']) > 60)) {                               
          die("L'adresse e-mail est trop court ou trop long-البريد إما طويل جدا أو قصير جدا");   
      }
      else if(!(preg_match("#@#",$_POST['email']))){
      die("L'adresse e-mail n'est pas correct, le symbole @ est absent     
            البريد غير صالح,  العلامة @ غير موجودة");  
      }
      else {
      } 
 
if ( empty($tel) ) {
    die("<center>Vous devez entrer votre numéro de téléphone-يجب أن تكتبوا رقم هاتفكم");
}
if ( empty($objetp) ) {
    die("<center>vous devez écrire le nom d'objet perdu-يجب أن تكتبوا إسم الشيئ الضائع");
}
if ( empty($description)) {
    die("<center>Vous devez décrir l'objet perdu-يجب وصف الشيئ الضائع"); 
}
 
 
// *************************
 
if(empty($_POST['name'])) {
        die("Vous devez écrire votre nom-يجب أن تكتبوا إسمكم"); 
     }
elseif ( (strlen($_POST['name']) < 3) || (strlen($_POST['name']) > 40)) {                 
        die("Le nom incorrect-الإسم غير صالح");
     }
else {
 
      }
 
if(empty($_POST['tel'])) {
          die("Vous devez entrer votre numéro de téléphone-يجب أن تكتبوا رقم هاتفكم");
      }
      elseif ((strlen($_POST['tel']) < 8) || (strlen($_POST['tel']) > 20)) { 
          die("Numéro de téléphone trop court ou trop long-رقم الهاتف إما طويل جدا أو قصير جدا");
      }
 
else {
          }            
 
 
if(empty($_POST['objetp'])) {
          die("Vous devez ecrire le nom d'objet perdu-يجب أن تكتبوا إسم الشيئ الضائع"); 
      }
 
elseif ((strlen($_POST['objetp']) < 3) || (strlen($_POST['objetp']) > 25)) { 
          die("Nom d'objet trop court ou trop long-إسم الشيئ الضائع طويل جدا أو قصير جدا");
      }
      else {  
      }
 
 
 
 
 
if(empty($_POST['description'])) {
          die("Vous devez décrire l'objet perdu-يجب وصف الشيئ الضائع");
      }
elseif ( (strlen($_POST['description']) < 5) || (strlen($_POST['description']) > 400)) {
          die("La description est trop courte ou trop longe-الوصف إما طويل جدا أو قصير جدا");
      }
else {
 
      }
 
$dossier = './imagesp/';
$fichier = basename($_FILES['image']['name']);
$taille_maxi = 1000000;
$taille = filesize($_FILES['image']['tmp_name']);
$extensions = array('.png', '.gif', '.jpg', '.jpeg','.bmp');
$extension = strrchr($_FILES['image']['name'], '.');  
//Début des vérifications de sécurité...
if(empty($fichier)){ $fichier="pas-d'imagep.jpg";}
else {         
if(!in_array($extension, $extensions)) //Si l'extension n'est pas dans le tableau 
{  
 die ("Vous devez uploader seulement une image de type: png, gif, jpg, jpeg ou bmp.         
 .bmp أو jpeg ,jpg ,gif ,png :ينبغي أن تكون الصورة المرفقة فقط من النوع 
 ");                                                       
}
 
if($taille>$taille_maxi)     
{   
     die ("Le fichier est trop gros...الصورة كبيرة الحجم");             
}
 
if(!isset($erreur)) //S'il n'y a pas d'erreur, on upload         
{
 
 
     //On formate le nom du fichier ici...   
     $fichier = strtr($fichier,
         'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',
         'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
     $fichier = preg_replace('/([^.a-z0-9]+)/i', '-', $fichier); 
     if(move_uploaded_file($_FILES['image']['tmp_name'], $dossier . $fichier)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné...
     {   }  
 
 else //Sinon (la fonction renvoie FALSE).     
     {  
         die ("Echec de téléchargement de photo ! هناك خطأ في تحميل الصورة");
 
     }
}
 
}  
 
 
connectejbardha_inscription();
if(empty($fichier)){ $fichier="pas-d'imagep.jpg";}  
 
date_default_timezone_set("UTC");
$date  = date("Y/m/d");
 
//Obtention de l'ID en incrmentant d'une unit
// le dernier ID cr.
$query= "select MAX(id) as id from objet_perdu";
$result=mysqli_query($a, $query);
if($row=mysqli_fetch_array($result)) {
    $id = ++$row[0];
}
else {
    echo mysqli_errno($base)." : ".mysqli_error($base);       
}
 
 
$query="INSERT into objet_perdu VALUES('".mysqli_real_escape_string(stripslashes($id))."','".mysqli_real_escape_string(stripslashes($name))."','".mysqli_real_escape_string(stripslashes($email))."','".mysqli_real_escape_string(stripslashes($tel))."','".mysqli_real_escape_string(stripslashes($objetp))."','".mysqli_real_escape_string(stripslashes($fichier))."','".mysqli_real_escape_string(stripslashes($description))."','".mysqli_real_escape_string(stripslashes($date))."')"; 
$result=mysqli_query($query);
if (!($result)) {
mysqli_connect_errno($result);                                                                                                            
}}
 
 //Affichage en retour des donnes enregistres.
 
?><table align= "center" border ="0" width= "100%" height= "79%">
<?php  
echo "  <tr><td align=center><font color= cyan > <h2><B>Merci, vos données sont conservées : شكرا , لقد تم حفظ معطياتكم</B></h2></font>","</td></tr>";                                               
echo "  <tr><td align=center><u><font color= cyan ><h2><B> Vous   أنتم </h2></B></u></font></tr></td>"; 
echo "  <tr><td align=center><h3><B>",$name," // ",$email," //  ",$tel,"</h3></B></tr></td>" ;
echo "  <tr><td align=center><u><font color= cyan ><h2><B>L'objet perdu  الشيء الضائع</h2></B></u></font></tr></td>";            
echo "  <tr><td align=center><h3><B>",$objetp,"</h3></B></tr></td>";
echo "  <tr><td align=center><h3><B>",$fichier,"</h3></B></tr></td>";
echo "  <tr><td align=center><h3><B>",$description,"</h3></B></tr></td>";           
echo "  <tr><td align=center><h3><B>",$date,"</h3></B></tr></td>";   
?>
</table>
<h3><A CLASS="menub" HREF="index.php"><center><b>Accueil-الرئيسية</center></b></A></h3>
<?php include("prc.php"); ?>
</body></html>


Et pour mon message d'erreur:

Warning: mysqli_query() expects parameter 1 to be mysqli, integer given in /home/ejbardha/public_html/stocke.php on line 148

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/ejbardha/public_html/stocke.php on line 149

Notice: Undefined variable: base in /home/ejbardha/public_html/stocke.php on line 153

Warning: mysqli_errno() expects parameter 1 to be mysqli, null given in /home/ejbardha/public_html/stocke.php on line 153

Notice: Undefined variable: base in /home/ejbardha/public_html/stocke.php on line 153

Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /home/ejbardha/public_html/stocke.php on line 153

:
Notice: Undefined variable: id in /home/ejbardha/public_html/stocke.php on line 157

Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in /home/ejbardha/public_html/stocke.php on line 157

Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/ejbardha/public_html/stocke.php on line 158

Merci, vos données sont conservées : شكرا , لقد تم حفظ معطياتكم
Vous أنتم
hhhhhhh // // 334456778
L'objet perdu الشيء الضائع
hhhhhhhhhhhh
pas-d'imagep.jpg
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
2016/07/04
Accueil-الرئيسية

Aidez-moi et me montrez mon erreur.