How can I do one single query with both an INSERT and SELECT in it and then read the results of selection? I want to insert and then select something, all must be done in one query...
I know it accept multiple commands in single query...But I want to read results of query and I cannot read results. I'm doing this:
$results=mysql_query("
INSERT INTO table1 (field1,field2) VALUES('aaa','bbbb') ON DUPLICATE KEY UPDATE `field1` = 'cccc', `field2`='dddddd';
SELECT field3 Form Table3 WHERE field3='eeeee';
",$connection);
while ($rows = mysql_fetch_array($results, MYSQL_NUM))
echo $rows[0];