List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 21 2003 12:57am
Subject:Re: Insert --> problem
View as plain text  
At 8:25 -0700 4/20/03, Karo Lina wrote:
>Hello all,
>
>
>
>I'm trying to insert data from (existing) variables into my tables, 
>using the following commands:
>
>
>
>int start = 6;

Okay.

>
>
>
>query_string = "INSERT INTO CLOCK (StartTime) VALUES %d", start;

Not okay.  What, exactly, do you expect that statement to do?

>
>mysql_query (conn, query_string);
>
>
>
>but when I look in the tables, a new row is created, but nothing is 
>inserted (value 0).
>
>
>
>I've also tried this using
>
>int start = 6;
>
>query_string = "INSERT INTO CLOCK (StartTime, StopTime) VALUES 
>('start', 'stop')";

Not surprising.  You're inserting the literal values 'start' and 'stop'
into (I guess) non-string columns, so they get converted to zero.


It'd also help if you provided some context, such as what language you're
using.  It may be obvious to you, but the rest of us don't know.

>
>mysql_query (conn, query_string);
>
>
>
>but the result is the sameÖ
>
>
>
>Any suggestions?
>
>
>
>Thanks!


-- 
Paul DuBois
http://www.kitebird.com/
sql, query
Thread
Insert --> problemKaro Lina20 Apr
  • RE: Insert --> problemDon Read20 Apr
  • Re: Insert --> problemMartin20 Apr
  • Re: Insert --> problemPaul DuBois21 Apr