S
S
Schoolboy.2015-09-27 14:32:06
PHP
Schoolboy., 2015-09-27 14:32:06

Fatal error: Call to undefined function prepare()?

I do:

$data = prepare('SELECT * FROM `users` WHERE `phone`= ?');
$data->execute(array($login));

Gives an error message:
Fatal error: Call to undefined function prepare()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2015-09-27
@viphorizon

Learning to think what is wrong with you as in this example

$var="User";
$dbh=new PDO("mysql:host=localhost;dbname=database;","root","");
$stmt=$dbh->prepare("UPDATE `users` SET user=:var");
$stmt->bindParam(":var",$var);
$stmt->execute();

I
IvanSenishin, 2015-09-27
@IvanSenishin

prepare method, not a function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question