aconite Posted March 14, 2007 Share Posted March 14, 2007 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); Link to comment https://forums.phpfreaks.com/topic/42680-creating-a-new-entry-in-a-table-using-variales-and-getdate-function/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.