Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

fonction mysqli de php5 sous freebsd

2 réponses
Avatar
hervest
Bonjour,
quelqu'un pourrait m'aider sur les nouvelles fonction mysqli de php voici mon code:

<?php

$host='localhost';
$user='root';
$pwd='';
$db='essai';

$var=1;

$conn=mysqli_connect($host,$user,$pwd,$db) or die('Erreur: '.mysqli_connect_error());

$insert="INSERT INTO test(id) VALUES(?)";
$stmt=mysqli_prepare($con,$insert);
mysqli_stmt_bind_param($stmt,'i',$var);
mysqli_stmt_execute($stmt);

if(mysqli_stmt_affected_rows($stmt)==1){
echo'vendeur bien ajouté';
$a=mysqli_stmt_insert_id($stmt); //le dernier enrégistrement
}

?>

j'ai cette erreur que je ne comprends pas du tout

Warning: mysqli_prepare() expects parameter 1 to be mysqli, null given in /usr/local/www/apache22/data/inf/testdb.php on line 13

Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, null given in /usr/local/www/apache22/data/inf/testdb.php on line 14

Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, null given in /usr/local/www/apache22/data/inf/testdb.php on line 15

Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, null given in /usr/local/www/apache22/data/inf/testdb.php on line 17

Merci

2 réponses

Avatar
Patrick Lamaizière
hervest wrote:

Bonjour,
quelqu'un pourrait m'aider sur les nouvelles fonction mysqli de php voici mon
code:

<?php



Vous aurez plus d'aide sur un forum sur le PHP : fr.comp.lang.php
Avatar
Arnaud Launay
[fu2 fclp]

Le 14-08-2008, hervest a écrit :
$conn=mysqli_connect($host,$user,$pwd,$db) or die('Erreur: '.mysqli_connect_error());
$insert="INSERT INTO test(id) VALUES(?)";
$stmt=mysqli_prepare($con,$insert);



Avec $conn, ça marchera mieux, c'est un peu con.

Arnaud.
--
Perso: http://launay.org/blog/
Hébergement: http://www.nocworld.com/