Page 1 of 1

Problem with SQL QUERY and timestamp

Posted: 24.10.2005, 16:28
by Mil0s

Code: Select all

ZQuery1.SQL.Clear;
MessageBox(0, PChar('SELECT unix_timestamp(end)-unix_timestamp(now()) as vreme FROM sessions WHERE uid="' + Form2.IDKorisnika + '" and status="a"'), 'sd', MB_OK);
ZQuery1.SQL.Add('SELECT unix_timestamp(end)-unix_timestamp(now()) as vreme FROM sessions WHERE uid="' + Form2.IDKorisnika + '" and status="a"');
ZQuery1.ExecSQL;

minuti := ZQuery1.FieldByName('vreme').AsInteger;

I got this code, I got problem, i cant read the field value?!
Anyone know what is the problem?!!?!
When i run query from mysql FRONT or mysql client its ok...

Posted: 25.10.2005, 07:55
by mdaems
Hi Mil0s,

I would use ZQuery1.Open instead of execsql. As I'm not mistaken, Execsql does not return a result but just executes some statements (eg insert, update, DDL,...).

If somebody knows this is not correct, please, tell us.

Mark

Posted: 25.10.2005, 11:16
by Mil0s
I think its ok, we will see in few minutes.
Tnx alot for answer ;)

Posted: 25.10.2005, 11:48
by Mil0s
Its working thnx man :)