<?php require 'utils.php'; utils_init(); $debug = 0; if ($debug) { print_r($_POST) . "\n"; } # parameters for this script... $p_name = my_get_post('name'); $p_typeId = my_get_post_or_null('typeId'); $p_externalId = my_get_post('externalId'); $p_externalCode = my_get_post('externalCode'); $p_end = javascriptdate_to_mysqldate(my_get_post('end')); if ($p_end != '') { $p_end = javascriptdate_to_mysqldate($p_end); } $p_personId = my_get_post('personId'); $p_locationId = my_get_post('locationId'); $p_deviceId = my_get_post('deviceId'); $p_remark = my_get_post('remark'); $p_ratingId = my_get_post('ratingId'); $p_review = my_get_post('review'); my_mysql_start_transaction(); // insert the actual work $query = sprintf('insert into TbWkWork (name,typeId) values(%s,%s)', my_mysql_real_escape_string($p_name), my_mysql_real_escape_string($p_typeId)); my_mysql_query($query); $p_workId = my_mysql_insert_id(); // insert an external id $query = sprintf('insert into TbWkWorkExternal (workId,externalId,externalCode) values(%s,%s,%s)', my_mysql_real_escape_string($p_workId), my_mysql_real_escape_string($p_externalId), my_mysql_real_escape_string($p_externalCode)); my_mysql_query($query);
<?php require 'utils.php'; utils_init(); $debug = 0; if ($debug) { print_r($_POST) . "\n"; } # parameters for this script... $p_personId = my_get_post('personId'); $p_name = my_get_post('name'); $p_imdbid = my_get_post('imdbid'); $p_date = javascriptdate_to_mysqldate(my_get_post('date')); $p_locationId = my_get_post('locationId'); $p_deviceId = my_get_post('deviceId'); $p_remark = my_get_post('remark'); $p_ratingId = my_get_post('ratingId'); $p_review = my_get_post('review'); // this is a line you can use for debugging... //error('query not yet implemented'); // my_mysql_start_transaction(); $p_typeId = my_mysql_query_one('select id from TbWkWorkType where name=\'video movie\''); $p_externalId = my_mysql_query_one('select id from TbExternalType where name=\'imdb_title_id\''); // insert the actual work $query = sprintf('insert into TbWkWork (name,typeId) values(%s,%s)', my_mysql_real_escape_string($p_name), my_mysql_real_escape_string($p_typeId)); my_mysql_query($query); $p_workId = my_mysql_insert_id(); // insert an external imdb id $query = sprintf('insert into TbWkWorkExternal (workId,externalId,externalCode) values(%s,%s,%s)', my_mysql_real_escape_string($p_workId), my_mysql_real_escape_string($p_externalId), my_mysql_real_escape_string($p_imdbid)); my_mysql_query($query);
<?php require 'utils.php'; utils_init(); $debug = 0; if ($debug) { print_r($_POST) . "\n"; } # parameters for this script... #$p_start=javascriptdate_to_mysqldate(my_get_post('start')); $p_end = javascriptdate_to_mysqldate(my_get_post('end')); #$p_personId=my_get_post('personId'); $p_locationId = my_get_post('locationId'); $p_activityId = my_get_post('activityId'); $p_remark = my_get_post('remark'); my_mysql_start_transaction(); # this is instead of getting it via the form above... $p_personId = my_mysql_query_one('select id from TbIdPerson where firstname=\'Mark\' and surname=\'Veltzer\''); $query = sprintf('insert into TbTdDone (end,personId,locationId,activityId,remark) values(%s,%s,%s,%s,%s)', my_mysql_real_escape_string($p_end), my_mysql_real_escape_string($p_personId), my_mysql_real_escape_string($p_locationId), my_mysql_real_escape_string($p_activityId), my_mysql_real_escape_string($p_remark)); my_mysql_query($query); $p_doneid = my_mysql_insert_id(); my_mysql_commit(); echo 'done item inserted with id [' . $p_doneid . ']';