Closed newjie closed 6 years ago
Check out the userid is the primary key with int type and auto-increase.
Do you mean you want me to check whether userid is the primary key and auto increases? No it is not. "id" is.
yes they are
@catfan same problem.
@catfan @newjie problem has been solved! Just add following lines to your database config:
'option' => [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
],
same problem,and i read the medoo code;the insert function :
$this->exec('INSERT INTO ' . $this->table_quote($table) . ' (' . implode(', ', $columns) . ') VALUES (' . implode($values, ', ') . ')');//this return 1
$lastId[] = $this->pdo->lastInsertId();//but if table has no auto-increment primary key,it returns 0
If a table has no autoincrement fields, what is the correct way to check for errors after an insert?
@flippolis Check out this post http://stackoverflow.com/a/40404306/2517690
Same problem.
For me is returning the string but not updating or retriving data from db
e.i I see: INSERT INTO "items" ("stock_number", "position") VALUES ('value1', 'val')
with debuggin on but there are no new inputs
I've tried setting the error options and I've put insert within a try catch and nothing.
insert
is now return PDOStatement object. You can now check out more info about this.
i had the same problem, and got that my mysql has been updated and it does not accept "tableName" for it's syntax. and also for column names.
I just started to use medoo to make my database learning live easier. My table has 5 fields:Primary ID,varchar Unique userid,varchar date,int status,varchar mark. I am able to do 'SELECT', so there is problem with the connection, but when I do insert:
$r
is always 0(if data inserted, it should be the last id), no matter what data I use. But$db->error()
returns00000
, which I believe means no error. The data is not inserted, also no error message in PHP error log. I can't figure out what is possibly wrong, please help.