if we have to insert records into a mysql database using c api then the general code is this
if (mysql_query(conn, "insert into empinfo values ('saikat banerjee')"))
{
printf("4Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
but, here we have to enter the record from the code itself .
but, i want to enter records from direct user inputs.
like, save the user input in a say, string variable and then use that string variable to store the record in the database. ie. i ant to do something like this
char empname[100]
and then,
if (mysql_query(conn, "insert into empinfo values (empname)"))
{
printf("4Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
but, this is storing NULL in the table.
is there any way to do this?
please help!