Link to home
Start Free TrialLog in
Avatar of roscoeh23
roscoeh23

asked on

Problem with prepare

Hi,

I am still having poblems with the php5 functions. I have 3 variables in
each. What is the problem?


Warning: mysqli_stmt::bind_param() [function.mysqli-stmt-bind-param]: Number
of elements in type definition string doesn't match number of bind variables
in xxxx on line 21

$prep = $mysqli->prepare ("UPDATE events SET title=?, date=?, content=?");
$prep->bind_param ( $_POST['title'], $_POST['date'], $_POST['content'],
$_POST['imageUrl']);

thanks,

H.
Avatar of NeoTeq
NeoTeq

In your prepare statement you have three params, and you're binding 4 of them? I think you forgot to include the fourth field in your query.

$prep = $mysqli->prepare ("UPDATE events SET title=?, date=?, content=?, imageurl=?");
$prep->bind_param ( $_POST['title'], $_POST['date'], $_POST['content'],
$_POST['imageUrl']);
Avatar of roscoeh23

ASKER

that was a mistype

$prep = $mysqli->prepare ("UPDATE events SET title=?, date=?, content=?");
$prep->bind_param ( $_POST['title'], $_POST['date'], $_POST['content']);

gives the error.
ASKER CERTIFIED SOLUTION
Avatar of NeoTeq
NeoTeq

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial