This topic is locked
[SOLVED]

 insert date into another record

11/3/2018 6:46:20 PM
PHPRunner General questions
P
PaulM author

Hi,
I'm trying to insert a record into another table within the afteradd event.
The code I'm using is :
$sql ="INSERT INTO Maintenance_Status(MS_M_id,MS_status,MS_user,MS_date) values ('".$values[M_id]."','$status','$_SESSION[UserID]','now()')";

CustomQuery($sql);
I've tried now(), date() and curdate() but none of them give me the date and just insert 00/00/0000

jadachDevClub member 11/3/2018

You will be better off using DAL methods.
https://xlinesoft.com/phprunner/docs/add.htm

P
PaulM author 11/3/2018



You will be better off using DAL methods.
https://xlinesoft.com/phprunner/docs/add.htm


Thanks but how do I add the date? That link doesn't show me?

S
steveh 11/3/2018

You need quotes around your array keys and no quotes aroybd now()

lefty 11/4/2018



Thanks but how do I add the date? That link doesn't show me?


[font="Verdana, Geneva, Arial, sans-serif"] // See This Link for 9.8 and 10.0 New Database API
[font="Verdana, Geneva, Arial, sans-serif"][size="2"]$data = array();[/size]
[font="Verdana, Geneva, Arial, sans-serif"][size="2"]$data["MS_status"] = $values["status"];[/size]
[font="Verdana, Geneva, Arial, sans-serif"][size="2"]$data["MS_date"] = now("%m-%d-%Y");[/size]

P
PaulM author 11/4/2018



You need quotes around your array keys and no quotes aroybd now()


THANK YOU, that is exactly what was wrong.