O
O
Oleg Pavlov2015-09-21 22:16:39
PHP
Oleg Pavlov, 2015-09-21 22:16:39

Why does the script insert several rows into the database at once instead of one?

Hello!
The problem is this:

$db = new mysqli("localhost", "root", "", "qb_test");
$query = "INSERT INTO mytable (`FirstName`, `LastName`, `Phone`) VALUES (?, ?, ?);";
$stm = $db->prepare($query);
$first = "Vasya";
$last = "Pupkin";
$tel = "123456";
$stm->bind_param("sss", &$first, &$last, &$tel);
$stm->execute();

this script inserts 4 identical queries into the database. I can't understand what's wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question