Hey guys, so im wondering if theres a way to insert 2 input values into one column in PDO? coz in mysql_* i just did something like this and it worked:

INSERT INTO tablename VALUES ('input1 input 2', 'input3');

pdo i tried :

$event = $dbh->prepare("INSERT INTO event(event_name,start_event,end_event,event_venue) 
VALUES('$name', CONCAT_WS('$dstart', '$tstart'), CONCAT_WS('$dend', '$tend'), '$venue')");

read that CONCAT_WS suppose to work but only the second parameter got inserted i.e :

$tstart when its suppose to be $dstart $tstart

TIA!

CONCAT_WS stands for concatenate with separator. It takes three parameters, the seperator, string1 and string 2. So in your case you told CONCAT_WS that "$dstart' is the separator rather than a value to concat. So either use
CONCAT_WS(' ', '$dstart', '$tstart') to separate by a space or just use CONCAT.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.