本文整理匯總了PHP中sql_db::sql_insert方法的典型用法代碼示例。如果您正苦於以下問題:PHP sql_db::sql_insert方法的具體用法?PHP sql_db::sql_insert怎麽用?PHP sql_db::sql_insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sql_db
的用法示例。
在下文中一共展示了sql_db::sql_insert方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: define
// We enter the detail in the database
if (isset($_POST['id']) == true) {
define('IN_APP', true);
include_once 'mysql.php';
$db = new sql_db();
$db->sql_open('localhost', 'db_user', 'db_password', 'db_name', true, '');
// Escape everything
foreach ($_POST as $key => $value) {
if (is_array($_POST[$key]) == false) {
$_POST[$key] = mysql_real_escape_string($value);
}
}
$data = 0;
// Enter the details in database
for ($i = 0; $i < count($_POST['time']); $i++) {
$db->sql_insert('markers', 'user_id, phone_id, locked, time, lat, lon, acc, spd', "'1', '{$_POST['id']}', '{$_POST['lock']}', '{$_POST['time'][$i]}', '{$_POST['lat'][$i]}', '{$_POST['lon'][$i]}', '{$_POST['acc'][$i]}', '{$_POST['spd'][$i]}'");
$data++;
}
echo 'Data received (' . $data . ') ' . time();
} else {
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL <?php
echo $_SERVER['PHP_SELF'];
?>
was not found on this server.</p>
<p>Additionally, a 404 Not Found