Is there a straightforward way to run mysql_query with an insert and get the ID of the new row, for example in the return? Or will I have to do another query with select to check it?
...
I am trying to add an additional column and value to an existing insert query - both integers, and running into trouble.
Anything to look out for?
...
Hi-- I'm stuck on a mySQL query using ON DUPLICATE KEY UPDATE.
I'm getting the error:
mySQL Error: 1062 - Duplicate entry 'hr2461809-3' for key 'fname'
The table looks like this:
id int(10) NOT NULL default '0',
picid int(10) unsigned NOT NULL default '0',
fname varchar(255) NOT NULL default '',
type varchar(5) NOT NULL default...
Suppose I have a MySQL table called MyTable, that looks like this:
+----+------+-------+
| Id | Type | Value |
+----+------+-------+
| 0 | A | 1 |
| 0 | B | 1 |
| 1 | A | 2 |
| 1 | B | 3 |
| 2 | A | 5 |
| 2 | B | 8 |
+----+------+-------+
And, for each Id, I want to insert a new row with...