int inside char*

I guess this is a simple question. Look this piece of code:

mysql_query(connection, "SELECT `id`, `password`, `group_id` FROM `accounts` LIMIT " << in << ";");

the second parameter is a char*, and in is an int. I just need to include in inside the second parameter correctly. I tried many times and didn't worked. How do I do this?
You could use a stringstream.
1
2
3
std::stringstream query;
query<<"SELECT `id`, `password`, `group_id` FROM `accounts` LIMIT " << in << ";";
mysql_query(connection, query.str().c_str());

I believe this would work.
Topic archived. No new replies allowed.