本文整理汇总了PHP中public_function::insertid方法的典型用法代码示例。如果您正苦于以下问题:PHP public_function::insertid方法的具体用法?PHP public_function::insertid怎么用?PHP public_function::insertid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类public_function
的用法示例。
在下文中一共展示了public_function::insertid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$public_function = new public_function();
$blog_userid = $_SESSION['UID'];
//插入或修改日程信息
$updateid = str_replace(" ", "", $_POST['updateid']);
$contents = str_replace(" ", "", $_POST['contents']);
$starttime = date("Y-m-d H:i", strtotime(str_replace(" ", "", $_POST['starttime'])));
$endtime = date("Y-m-d H:i", strtotime(str_replace(" ", "", $_POST['endtime'])));
$types = str_replace(" ", "", $_POST['types']);
$userid = str_replace(" ", "", $blog_userid);
$dates = CURRENT_TIME;
$titles = str_replace(" ", "", $_POST['titles']);
$importent = str_replace(" ", "", $_POST['importent']);
//echo $contents."<br/>".$starttime."<br/>".$endtime."<br/>".$types."<br/>".$userid."<br/>".$dates."<br/>".$titles;
if ($updateid == 0 || $updateid == "" || $updateid == null) {
$insert_richeng_sql = "insert into blog_richeng(contents,starttime,endtime,types,userid,dates,titles,importent)\n\tvalues('{$contents}','{$starttime}','{$endtime}','{$types}','{$userid}','{$dates}','{$titles}','{$importent}')";
$insert_richeng_result = $public_function->getresult($insert_richeng_sql);
$insert_richeng_id = $public_function->insertid();
if ($insert_richeng_result > 0) {
echo "<script>location.href='../richeng_gl.php?info=success'</script>";
} else {
echo "<script>location.href='../richeng_gl.php?info=fail'</script>";
}
} else {
$update_richeng_sql = "update blog_richeng set\n\tcontents='{$contents}',\n\tstarttime='{$starttime}',\n\tendtime='{$endtime}',\n\ttypes='{$types}',\n\tuserid='{$userid}',\n\tdates='{$dates}',\n\ttitles='{$titles}', \n\timportent='{$importent}'\n\twhere ids='{$updateid}'";
$update_richeng_result = $public_function->getresult($update_richeng_sql);
if ($update_richeng_result > 0) {
echo "<script>location.href='../richeng_gl.php?info=success'</script>";
} else {
echo "<script>location.href='../richeng_gl.php?info=fail'</script>";
}
}