At 15:18 -0800 11/1/04, Stephen Rasku wrote:
I am using the C API with MySQL 4.0.17 on QNX 6.2.1b.
I want to update the rows that are returned as I get them. Is this
possible. Here's a simplified version of what I am trying to do:
query = "select seqNo, priority from packet where timestamp < now() -
interval 15 second order by priority desc, timestamp";
mysql_query(&mysql, query);
result = mysql_use_result(&mysql);
while (row = mysql_fetch_row(result))
{
seqNo = atoi(row[0]);
priority = atoi(row[1]);
sprintf(updateStr, "update packet set timestamp = now() where
seqNo = %d", seqNo);
mysql_query(&mysql, updateStr);
}
However, when I do this, I get:
Commands out of sync; You can't run this command now
Anyone have any ideas on how to to accomplish this?
You have to use mysql_store_result(), not mysql_use_result().
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]