[PHP-DB] Re: How to get last insert id safely?

2007-12-05 Thread Mazzu
If the first query doesn't fail you can be sure that last_insert_id() for A while return the ID of his name because 1) "The ID that was generated is maintained in the server on a per-connection basis. This means that the value returned by the function to a given client is the first AUTO_INCREMENT

[PHP-DB] How to get last insert id safely?

2007-12-05 Thread Jacky
Hi All, How to get last insert id safely in php with persistent connection to mysql?because there may be larger concurrence requests to the php to query insert statements.Example,the php query following two sql statements: mysql_query("insert into tb(id,name) values(null,$username)"); $res = mys

Re: [PHP-DB] rtrim a string with MySQL's function

2007-12-05 Thread Evert Lammerts
You can use regular expressions in mysql to check for the right format, but (as far as i know) you can not return any matches: SELECT * FROM table WHERE column REGEX '[0-9]+';, which returns all records where column has a digit in its value. In PHP however, you can easily get the matches: $var