Probabyl its a fairly easy question, Im new to PHP/Mysql and have problem with the following:
How can I get all this into a single line of code, instead of using $date_from1, $date_from2 etc. Ive tried with some arrays but the SQL gets messed up and I cant get out of it. I know that I need to get my values defined by an array but the think I get problems with the SQL syntax??
Thanks,
/* Insert query into the Database*/
$sql = mysql_query("INSERT INTO activities (ref_num, act_type_id, date_from, date_to, activity_place, activity_contact, insert_date)
VALUES('$r_num','$act_type_id','$date_from1','$date_to1', '$activity_place', '$activity_contact', now())") or die (mysql_error());
$sql = mysql_query("INSERT INTO activities (ref_num, act_type_id, date_from, date_to, activity_place, activity_contact, insert_date)
VALUES('$r_num','$act_type_id','$date_from2','$date_to2', '$activity_place', '$activity_contact', now())") or die (mysql_error());
$sql = mysql_query("INSERT INTO activities (ref_num, act_type_id, date_from, date_to, activity_place, activity_contact, insert_date)
VALUES('$r_num','$act_type_id','$date_from3','$date_to3', '$activity_place', '$activity_contact', now())") or die (mysql_error());







Bookmarks