Php,Warning: in_array() expects parameter 2 to be array, str
jeanluc
-
jordane45 Messages postés 40052 Date d'inscription Statut Modérateur Dernière intervention -
jordane45 Messages postés 40052 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour,
j'ai un probleme avec mon code, quand j'envoi ça vient
Warning: in_array() expects parameter 2 to be array, string given in line 25
je suis debutant en php, aidez moi svp, en corrigeant mon code si possible
mon code de connexion
Edit: ajout des balises de code
j'ai un probleme avec mon code, quand j'envoi ça vient
Warning: in_array() expects parameter 2 to be array, string given in line 25
je suis debutant en php, aidez moi svp, en corrigeant mon code si possible
mon code de connexion
<?php
$conn = mysqli_connect("localhost", "username", "password", "dbname");
if(!$conn){
die("Error: Failed to connect to database!");
}
?>
<?php
date_default_timezone_set("Etc/GMT+8");
require_once 'conn.php';
if(ISSET($_POST['upload'])){
$file_name = $_FILES['image']['name'];
$file_temp = $_FILES['image']['tmp_name'];
$date_upload = date("Y-m-d");
$allowed_ext = array("jpeg", "jpg", "gif", "png");
$exp = explode(".", $file_name);
$ext = end($exp);
$path = "../es/uploads/".$file_name;
$nome = !empty($_POST['nome']) ? $_POST['nome'] : NULL;
$mail = !empty($_POST['mail']) ? $_POST['mail'] : NULL;
$numero = !empty($_POST['numero']) ? $_POST['numero'] : NULL;
$nomeA = !empty($_POST['nomeA']) ? $_POST['nomeA'] : NULL;
$formato = !empty($_POST['formato']) ? $_POST['formato'] : NULL;
$categorie = !empty($_POST['categorie']) ? $_POST['categorie'] : NULL;
$cadre = !empty($_POST['cadre']) ? $_POST['cadre'] : NULL;
if(in_array($conn, $ext, $allowed_ext)){
if(move_uploaded_file($file_temp, $path)){
mysqli_query($conn, "INSERT INTO `image` VALUES('', '$file_name', '$date_upload', '$nome','$mail','numero','nomeA','formato','categorie','cadre')") or die(mysqli_error());
echo "<center><h5 class='text-success'>Pedido enviado!!</h5></center>";
}
}else{
echo "<center><h5 class='text-danger'>Erro, image legivel jpeg, jpg, png !</h5></center>";
}
}
?>
Edit: ajout des balises de code
A voir également:
- In_array() expects parameter 2 to be array, null given
- Easy php - Télécharger - Divers Web & Internet
- Warning zone telechargement - Accueil - Outils
- Expert php pinterest - Télécharger - Langages
- Symbole warning word - Forum Word
- Comment faire le symbole attention ✓ - Forum Loisirs / Divertissements