Wrong datatype for second argument in
johny88888
-
johny88888 -
johny88888 -
Bonjour,
J'ai un message d'erreur lors de l'ajout d'un article:
Warning: array_search() [function.array-search]: Wrong datatype for second argument in /web/bike4lifeshop/www/fonctions-panier.php on line 36
Warning: array_push() [function.array-push]: First argument should be an array in /web/bike4lifeshop/www/fonctions-panier.php on line 45
Warning: array_push() [function.array-push]: First argument should be an array in /web/bike4lifeshop/www/fonctions-panier.php on line 47
La valeur de recherche est un numéro d'article.
je ne comprend pas pourquoi il met ça, si je change idproduit par libelleproduit plus d'erreur !!! est ce parce que c'est un chiffre?
Merci de votre aide
J'ai un message d'erreur lors de l'ajout d'un article:
Warning: array_search() [function.array-search]: Wrong datatype for second argument in /web/bike4lifeshop/www/fonctions-panier.php on line 36
Warning: array_push() [function.array-push]: First argument should be an array in /web/bike4lifeshop/www/fonctions-panier.php on line 45
Warning: array_push() [function.array-push]: First argument should be an array in /web/bike4lifeshop/www/fonctions-panier.php on line 47
La valeur de recherche est un numéro d'article.
function ajouterArticle($idProduit,$photoProduit,$marque,$libelleProduit,$option,$qteProduit,$prixProduit){ //Si le panier existe if (creationPanier() && !isVerrouille()) { //Si le produit existe déjà on ajoute seulement la quantité //ligne36 $positionProduit = array_search($idProduit, $_SESSION['panier']['idProduit']); if ($positionProduit !== false) { $_SESSION['panier']['qteProduit'][$positionProduit] += $qteProduit ; } else { //Sinon on ajoute le produit //ligne45 array_push( $_SESSION['panier']['idProduit'],$idProduit); array_push( $_SESSION['panier']['photoProduit'],$photoProduit); //ligne47 array_push( $_SESSION['panier']['marque'],$marque); array_push( $_SESSION['panier']['libelleProduit'],$libelleProduit); array_push( $_SESSION['panier']['option'],$option); array_push( $_SESSION['panier']['qteProduit'],$qteProduit); array_push( $_SESSION['panier']['prixProduit'],$prixProduit); } } else echo "Un problème est survenu veuillez contacter l'administrateur du site."; }
je ne comprend pas pourquoi il met ça, si je change idproduit par libelleproduit plus d'erreur !!! est ce parce que c'est un chiffre?
Merci de votre aide
A voir également:
- Wrong datatype for second argument in
- Downloader for pc - Télécharger - Téléchargement & Transfert
- Navigation in private - Guide
- Deco in paris avis ✓ - Forum Consommation & Internet
- Déco in paris site fiable ???? - Forum Consommation & Internet
- Girl in the basement streaming vf - Forum Cinéma / Télé
2 réponses
Merci pour ton aide, après encore avoir chercher 3h j'ai coupé le pc et recommencer un peu plus tard et résultat ca marche.
A bientot
A bientot
Les messages d'erreurs sont super explicites quand même... Wrong datatype for second argument mmm ca voudrait pas dire que t'as un mauvais type de variable en second argument de la fonction ??
Et pour savoir le bon type : https://www.php.net/array_search
Et maintenant, regarde le type de ta variable avec un var_dump($_SESSION['panier']['idProduit']);
Tu vas tout débugger comme ça ;)
Et pour savoir le bon type : https://www.php.net/array_search
Et maintenant, regarde le type de ta variable avec un var_dump($_SESSION['panier']['idProduit']);
Tu vas tout débugger comme ça ;)