MySQL C API: check if a field exists -
i'm new mysql programming on c. need check if user exists in table. how can using c api? here's i've got, isn't working:
if (mysql_query(con, "select * users username='user3'")) { finish_with_error(con); } mysql_res *result = mysql_store_result(con); if (result == null) { finish_with_error(con); } int count = mysql_field_count(con); printf("%d\n", count );
for interested, wrote using comments, , ended using.
if (mysql_query(con, "select field table username='user1'")) { finish_with_error(con); } mysql_res *result = mysql_store_result(con); if (result == null) { finish_with_error(con); } mysql_row row; mysql_field *field; if (row = mysql_fetch_row(result)) { printf("%s\n", row[0]); db_pwd = row[0]; }
Comments
Post a Comment