0

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!

2
Contributors
1
Reply
10
Views
3 Years
Discussion Span
Last Post by hericles
1

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.