List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 13 2003 5:33am
Subject:Re: problem with C and mysql 4
View as plain text  
At 22:21 -0700 5/12/03, Carl B. Constantine wrote:
>I looked over the lists and I can't see a specific C programming list,
>only the C++ list so this seems like the best place to ask my question.
>
>I have a strange problem with mysql 4.0.12 (downloaded and installed
>from RPM on the mysql.com site) and some C I'm writting in a GTK+
>application. If I write code such as:
>
>if (mysql_query(conx, "select * from customers) != 0) {
>   g_print(" query failed");
>} else
>   g_print("query succeeded\n");
>
>I get successful results.
>
>Upon a success though, I try to insert into the DB like so:
>
>if (mysql_query(conx,"insert into customers(name) values('testing')") !=0) {
>   g_print("query failed\n");
>} else
>  g_print("sucess\n");
>
>I always get a failed result and a subsequent select also fails at that
>point. This is in the same routine that I've just done the query to
>verify a successful connection to the DB. I've tried all kinds of things
>to no avail. I'm using Matthew Stucky's "MySQL: Building User
>Interfaces" as a guide.
>
>Anyone know what is up?

Print the values of mysql_error() and mysql_errno() and see what
they tell you.

>
>--
>  .''`.      Carl B. Constantine
>: :' :     duckwing@stripped
>`. `'    GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
>   `-  Debian GNU/Linux -- The power of freedom


-- 
Paul DuBois
http://www.kitebird.com/
sql, query
Thread
problem with C and mysql 4Carl B. Constantine13 May
  • Re: problem with C and mysql 4Dobromir Velev13 May
  • Re: problem with C and mysql 4Allen Grace13 May
  • Re: problem with C and mysql 4Paul DuBois14 May
  • Re: problem with C and mysql 4Fred van Engen14 May
RE: problem with C and mysql 4Bruce W. Marriner13 May
  • RE: problem with C and mysql 4Paul DuBois14 May
Re: problem with C and mysql 4Paul DuBois13 May
Re: problem with C and mysql 4Carl B. Constantine14 May
Re: problem with C and mysql 4Carl B. Constantine14 May
Re: problem with C and mysql 4Carl B. Constantine14 May
  • Re: problem with C and mysql 4Paul DuBois14 May