aconite
03-15-2007, 06:21 AM
the variable vlues are:
$trans_date = getdate();
$tran_source=5487335;
$thePswd=1111;
$theDest=1234567;
$theAmmount = 20;
$trans_date2 = getdate();
the query is:
if(!mysql_query("insert into transaction(source,destination,amount,date,strt_time,end_time,status)
values($transSource,$theDest,$theAmmount,trans_date[mday]:$trans_date[mmon]:$trans_date[year],trans_date[seconds]:$trans_date[minutes]:$trans_date[hours],trans_date2[seconds]:$trans_date2[minutes]:$trans_date2[hours],TRUE)")
{
echo "query not executed";
}
i want the date to be displayed in dd:mm:yy
i know the prob is in the query syntax but i cant understand how to use the getDate func and also shld i use '$tranSource'??
data types given when the table was created:
CREATE TABLE transaction
(id INT(4) AUTO_INCREMENT NOT NULL PRIMARY KEY,
source INT(7) UNSIGNED,
destination INT(7) UNSIGNED,
amount INT(3) NOT NULL,
date DATE ,
strt_time TIME ,
end_time TIME ,
status ENUM(\"TRUE\",\"FALSE\") NOT NULL);
$trans_date = getdate();
$tran_source=5487335;
$thePswd=1111;
$theDest=1234567;
$theAmmount = 20;
$trans_date2 = getdate();
the query is:
if(!mysql_query("insert into transaction(source,destination,amount,date,strt_time,end_time,status)
values($transSource,$theDest,$theAmmount,trans_date[mday]:$trans_date[mmon]:$trans_date[year],trans_date[seconds]:$trans_date[minutes]:$trans_date[hours],trans_date2[seconds]:$trans_date2[minutes]:$trans_date2[hours],TRUE)")
{
echo "query not executed";
}
i want the date to be displayed in dd:mm:yy
i know the prob is in the query syntax but i cant understand how to use the getDate func and also shld i use '$tranSource'??
data types given when the table was created:
CREATE TABLE transaction
(id INT(4) AUTO_INCREMENT NOT NULL PRIMARY KEY,
source INT(7) UNSIGNED,
destination INT(7) UNSIGNED,
amount INT(3) NOT NULL,
date DATE ,
strt_time TIME ,
end_time TIME ,
status ENUM(\"TRUE\",\"FALSE\") NOT NULL);