prova così
codice:
char str[lunghezza_opportuna];

sprintf(str, "INSERT INTO dati (x, y, temperature) VALUES (%d,%d,%d)", x, y, temp);

mysql_query(conn,
str);