Call to a member function execute() on boolean

Résolu/Fermé
iamlouky Messages postés 15 Date d'inscription mardi 26 décembre 2017 Statut Membre Dernière intervention 23 janvier 2024 - 16 janv. 2018 à 04:19
jordane45 Messages postés 38144 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 21 avril 2024 - 16 janv. 2018 à 07:53
Bonjour,

Je suis entrain de mettre unen ligne, et il y a ce problème qui se pose :
    • Fatal error: Uncaught Error: Call to a member function execute() on boolean in /storage/ssd3/068/4295068/public_html/authentification/transfert4.php:46 Stack trace: #0 {main} thrown in /storage/ssd3/068/4295068/public_html/authentification/transfert4.php on line 46**



Voici mon code :

<?php

// à mettre tout en haut du fichier .php, cette fonction propre à PHP servira à maintenir la $_SESSION
session_start();
include("config.php");

$error = false;
$adminpageError = "";
$code4Error = "";
$code4noncorrespondError = "";

if (isset($_SESSION['username']) && $_SESSION['username'] =="admin") {
$adminpageError = "<p><a href='inscription.php'>Admin page </a></p>";
}

if(isset($_POST['valider'])){
if (empty($_POST['code'])) {
$error = true;
$codetransfert4Error = "Please enter the transfer code .";
} else {
$code4 = htmlentities($_POST['code4'], ENT_QUOTES, "ISO-8859-1");
$mysqli = mysqli_connect("localhost", "id4295068_roomadmin", "", "id4295068_projet");
if (!$mysqli) {
echo "Please check your information and try again";
} else {
$query = "SELECT * FROM `client6` WHERE code4='".$code4."'";
$result = mysqli_query($mysqli,$query) or die(mysqli_error());
$rows = mysqli_num_rows($result);
if($rows==1) {
header("location: load4.php");
} else {
$query = "SELECT * FROM `client6` WHERE code4='".$code4."'";
$result = mysqli_query($mysqli,$query) or die(mysqli_error());
$rows = mysqli_num_rows($result);
if($rows==0) {
header("location: transfert4non.php");
}
}
}
}
}
// Si tout va bien, on peut continuer
// On récupère tout le contenu de la table client6
$req = $mysqli->prepare('SELECT * FROM `client6` WHERE username = :username');
$req->execute(array('username' => $_SESSION['username']));

// On affiche chaque entrée une à une
while ($donnees = $req->fetch())
A voir également:

1 réponse

jordane45 Messages postés 38144 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 21 avril 2024 4 650
16 janv. 2018 à 07:53
Bonjour

Tu fais la connexion à la bdd en style procédurale... Tu ne peux donc pas utiliser le style objet pour faire ta requête....

0