To whom it may concern:
I am running MySQL ver 3.22.20a
My compiler is egcs 1.1.2 on a SUN Ultra 1 with Solaris 2.6
I am trying to write CGIs to access MySQL via a web browser. (written in C)
I am trying to pass a string into my mysql_query function call (using INSERT
as the MySQL command)
The mysql_query command (takes the MySQL command in quotes)
My string is declared as char *input;
as is being passed into a function as a parameter.
here is what I have:
// Send the query to the database
if (mysql_query(&mysql, "INSERT INTO test VALUES('input')") != 0) {
printf("Error sending query: %s\n", mysql_error(&mysql));
return (2);
The above does not work because the input is in the quotes(ie its putting
the word input into my table not the value of table)
How do I pass the variable into an INSERT command?
I couldn't find any examples in the client code.
Any help is greatly appreciated.
-Tavaris
tavaris@stripped