RE: inserting into mysql database in linux using C

2001-03-26 Thread Sean Conley
You need to have quotes around test in the insert statement. So it would be as follows: sprintf (query, "INSERT INTO tablename (userid) VALUES(\"%s\")", test"); res=mysql_query(connection, query); Oviously query needs declaration here, but the SQL has to be quoted exactly the same as if you were

Re: inserting into mysql database in linux using C

2001-03-26 Thread Lindsay Adams
l. > > -Original Message- > From: john lin [mailto:[EMAIL PROTECTED]] > Sent: Sunday, March 25, 2001 2:56 PM > To: [EMAIL PROTECTED] > Subject: inserting into mysql database in linux using C > > > I am a senior in Polytechnic University working on my > senior project. I have chosen MyS

RE: inserting into mysql database in linux using C

2001-03-26 Thread Rick Emery
Maybe you just gave a snippet, but I don't see where you established the connection to the database, thereby giving the variable "connection" a value. It appears to be undefined. Therefore, the mysql_query() would fail. -Original Message- From: john lin [mailto:[EMAIL PROTECTED]] Sent:

Re: inserting into mysql database in linux using C

2001-03-25 Thread Fred van Engen
On Sun, Mar 25, 2001 at 12:56:15PM -0800, john lin wrote: > I am a senior in Polytechnic University working on my > senior project. I have chosen MySQL to be database in > Red Hat linux 7.0. I writing a program to insert a > value into the database in c language. The data > changes so i have to

Re: inserting into mysql database in linux using C

2001-03-25 Thread MikeBlezien
On Sun, 25 Mar 2001 12:56:15 -0800 (PST), john lin <[EMAIL PROTECTED]> wrote: John, I'm not a 'C' programmer, but I think you need to enclose your VALUE with single quotes for a literal value: VALUES('test') Atleast in Perl, it' done that way. >>I am a senior in Polytechnic University work