Why can't I insert to my database? I've read multiple threads regarding this error and all of their problems were that they forgot calling open for the database. Help?
sqlite3 *data;
sqlite3_stmt *res;
char *errMSG;
int sql=0;
const char *tail;
char insert[100];
sql = sqlite3_open("pokemon.db", &data);
if(sql){
puts("Can't open database");
exit(0);
}
sprintf(insert, "Insert into Players values('%s','%s',1, 0,%d,%d,%d,0,0,'%s');", name, species, HP, ATTK, DEF, key);
sql = sqlite3_prepare_v2(data, insert, 1000, &res, &tail);
printf("%d\n",sql);
sqlite3_step(res);
sqlite3_finalize(res);
sqlite3_close(data);
printf("You have successfully captured a new Pokemon!<br>");
printf("%s", sqlite3_errmsg(data));
printf("<form action=start.cgi><input type=submit value='Go back to Home Page!'></form>");
printf("</body></html>");
return 0;