Answer the question
In order to leave comments, you need to log in
How to get a column that has autoincrement?
After inserting a row into the table, you need to get the id, how to do it?
$questionmarks = array_fill(0, sizeof($properties), '?');
$stmt = self::$db->prepare('INSERT INTO `' . static::getTableName() . '` (' . implode(',', array_keys($properties)) . ') VALUES (' . implode(',', $questionmarks) . ')');
$stmt->execute(array_values($properties));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question