문제

I have a many things to insert into database colums.

    $connect->prepare("INSERT INTO users (username, password, message, date, time, id) VALUES (:username, :password, :message, :date, :time, :id");

Instead of binding them all, I created a array:

    $IDs = array($username, $password, $message, $time, $date, $ID);

How do I take each variable from this array and bind it? I am completely lost with PDO.

도움이 되었습니까?

해결책

use:

$sth->execute(array(':username' => $username, ':password' => $password, $message, $time, $date, $ID))

and for others...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top