本文整理汇总了PHP中DBUtils::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils::insert方法的具体用法?PHP DBUtils::insert怎么用?PHP DBUtils::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtils
的用法示例。
在下文中一共展示了DBUtils::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public static function add($param)
{
$pdo = new DBUtils();
$key_str = "";
$val_str = "";
$sql = "";
if (isset($param['type'])) {
$key_str .= "type,";
$val_str .= "'{$param['type']}',";
}
if (isset($param['studentName'])) {
$key_str .= "studentName,";
$val_str .= "'{$param['studentName']}',";
}
if (isset($param['num'])) {
$key_str .= "num" . ",";
$val_str .= "'{$param['num']}',";
}
$now = time();
$key_str .= "time" . ",";
$val_str .= "'{$now}',";
$key_str .= "course" . ",";
$val_str .= "'{$GLOBALS['STUDENT_COURSE_TYPE'][0]}',";
$key_str = substr($key_str, 0, strlen($key_str) - 1);
$val_str = substr($val_str, 0, strlen($val_str) - 1);
$sql = "insert into student_news (" . $key_str . ")";
$sql .= " VALUES (" . $val_str . ")";
$articleId = $pdo->insert($sql);
return $articleId;
}
示例2: savePhoto
public static function savePhoto($param)
{
$pdo = new DBUtils();
$create_time = time();
$sql = "insert into photo (photoName, photoUrl, create_time)";
$sql .= " VALUES ('{$param['photoName']}', '{$param['photoUrl']}', '{$create_time}')";
$rs = $pdo->insert($sql);
return $rs;
}
示例3: add
public static function add($param)
{
$pdo = new DBUtils();
$key_str = "";
$val_str = "";
$sql = "";
if (isset($param['content'])) {
$key_str .= "content,";
$val_str .= "'{$param['content']}',";
}
if (isset($param['title'])) {
$key_str .= "title,";
$val_str .= "'{$param['title']}',";
}
if (isset($param['snavId'])) {
$key_str .= "snavId" . ",";
$val_str .= "'{$param['snavId']}',";
}
if (isset($param['smallContent'])) {
$key_str .= "smallContent" . ",";
$val_str .= "'{$param['smallContent']}',";
}
if (isset($param['articleImg'])) {
$key_str .= "articleImg" . ",";
$val_str .= "'{$param['articleImg']}',";
}
$now = time();
$key_str .= "time" . ",";
$val_str .= "'{$now}',";
$key_str = substr($key_str, 0, strlen($key_str) - 1);
$val_str = substr($val_str, 0, strlen($val_str) - 1);
$sql = "insert into article (" . $key_str . ")";
$sql .= " VALUES (" . $val_str . ")";
$articleId = $pdo->insert($sql);
return $articleId;
}
示例4: saveJoinus
public static function saveJoinus($param)
{
$pdo = new DBUtils();
$key_str = "";
$val_str = "";
$sql = "";
if (isset($param['bus_name'])) {
$key_str .= "bus_name,";
$val_str .= "'{$param['bus_name']}',";
}
if (isset($param['address'])) {
$key_str .= "address,";
$val_str .= "'{$param['address']}',";
}
if (isset($param['phone'])) {
$key_str .= "phone" . ",";
$val_str .= "'{$param['phone']}',";
}
if (isset($param['email'])) {
$key_str .= "email" . ",";
$val_str .= "'{$param['email']}',";
}
if (isset($param['others'])) {
$key_str .= "others" . ",";
$val_str .= "'{$param['others']}',";
}
$now = time();
$key_str .= "time" . ",";
$val_str .= "'{$now}',";
$key_str = substr($key_str, 0, strlen($key_str) - 1);
$val_str = substr($val_str, 0, strlen($val_str) - 1);
$sql = "insert into joinus (" . $key_str . ")";
$sql .= " VALUES (" . $val_str . ")";
$id = $pdo->insert($sql);
return $id;
}
示例5: addCourse
public static function addCourse($param)
{
$pdo = new DBUtils();
$key_str = "";
$val_str = "";
$sql = "";
if (isset($param['courseId'])) {
$key_str .= "courseId,";
$val_str .= "'{$param['courseId']}',";
}
if (isset($param['courseName'])) {
$key_str .= "courseName,";
$val_str .= "'{$param['courseName']}',";
}
$key_str = substr($key_str, 0, strlen($key_str) - 1);
$val_str = substr($val_str, 0, strlen($val_str) - 1);
$sql = "insert into course (" . $key_str . ")";
$sql .= " VALUES (" . $val_str . ")";
$courseId = $pdo->insert($sql);
return $courseId;
}