Tag: mysql connector c

在MYSQL C API中处理SELECT查询结果的问题

我的一个脚本出现了内部服务器错误。 我正在使用MYSQL C API。 https://dev.mysql.com/doc/refman/5.6/en/c-api.html 这是我的脚本的相应部分: MYSQL *con; MYSQL_RES *result; MYSQL_ROW robe; con = mysql_init(NULL); if (!mysql_real_connect(valid values)) { printf(“Content-type: text/html\n\n”); printf(“Could not connect\n”); exit(0); } char somequery[512]; //userinput is sanitized beforehand int sog = sprintf(somequery, “SELECT password from testtab WHERE username=’%s'”, userinput); if (sog < 0) { printf("Content-type: text/html\n\n"); printf("Something went wrong with Sprintf\n"); […]