Problem with SQL QUERY and timestamp

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Mil0s
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 24.10.2005, 16:22

Problem with SQL QUERY and timestamp

Post 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...
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Mil0s
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 24.10.2005, 16:22

Post by Mil0s »

I think its ok, we will see in few minutes.
Tnx alot for answer ;)
Mil0s
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 24.10.2005, 16:22

Post by Mil0s »

Its working thnx man :)
Post Reply