本文整理汇总了PHP中insertdata函数的典型用法代码示例。如果您正苦于以下问题:PHP insertdata函数的具体用法?PHP insertdata怎么用?PHP insertdata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insertdata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mysql_fetch_assoc
$detailcheck = mysql_fetch_assoc($convus);
// $count="0";
if ($repeatinguser == $detailcheck["username"]) {
$count = "SELECT MAX(id) FROM `tbl`";
$maximum = mysql_query($count);
$v = mysql_fetch_row($maximum);
$id_value = $v[0];
$id_value++;
$repeatinguser = "{$id_value}{$repeatinguser}";
$ups = "INSERT INTO `tbl` (`id`, `name`, `email`, `username`,`gender`, `mobile`, `encpassword`,`uniqueid`,`role_id`)\n\t\t VALUES (NULL,'{$name}','{$email}','{$repeatinguser}','{$gender}', '{$mobile}', '{$encpassword}','','0')";
$convus = mysql_query($ups);
header('Refresh:10; url=login.php');
$var = "Successfully registered";
$output = "an email has been sent to your registered email-id" . "<br>" . "Plz log in with the same credentials" . "<br>" . "the page is being transferred plz wait" . "<br>" . "thankyou for registration";
} else {
$resource = insertdata($name, $username, $email, $gender, $mobile, $encpassword);
if ($resource) {
header('Refresh:10; url=login.php');
$var = "Successfully registered";
$output = "an email has been sent to your registered email-id" . "<br>" . "Plz log in with the same credentials" . "<br>" . "the page is being transferred plz wait" . "<br>" . "thankyou for registration";
} else {
header('Refresh:2; url=registration.php');
$var = "Could not process";
}
}
if ($var === "Successfully registered") {
$to = $email;
$subject = "successfully registered to innotraining";
$msg = "your username for login is:{$repeatinguser}<br/>";
$from = "From :innotrainning@drupal.com ";
mail($to, $subject, $msg, $from);
示例2: array
<?php
include '../includes/dbutil.php';
include 'includes/validation.php';
$parameters = array('user_id', 'post_id', 'post_type');
$is_parameter_available = is_post_parameters_exists($parameters);
if ($is_parameter_available == 0) {
extract($_POST);
$count = get_row_count_by_condition("users", "WHERE upid=" . $user_id);
if ($count > 0) {
$usrData = array('user_id' => $user_id, 'post_id' => $post_id, 'post_type' => $post_type);
//$pcount=get_row_count_by_condition("post_add","WHERE post_id=".$_SESSION['last_id']." and upid=".$_SESSION['upid']);
insertdata($usrData, 'short_lists');
//$result['post_id'] = mysql_insert_id();
$result['status'] = 'success';
echo json_encode($result);
} else {
echo json_encode(array("status" => "failed"));
}
} else {
echo json_encode(array("status" => "failed"));
}
示例3: myerror
<?php
if ($start == 0 && $_SESSION['phpnuke'] != '') {
echo '<script type="text/javascript">window.location="index.php?page=' . ++$_GET['page'] . '"</script>';
exit;
}
$result = $fdb->query('SELECT * FROM ' . $_SESSION['php'] . 'banlist WHERE ban_id>' . $start . ' ORDER BY ban_id LIMIT ' . $_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['ban_id'];
$username = '';
if ($ob['ban_userid'] != 0) {
$res = $db->query('SELECT username FROM ' . $_SESSION['pun'] . 'users WHERE id=' . $ob['ban_userid']) or myerror("Unable to get userinfo for ban", __FILE__, __LINE__, $db->error());
list($username) = $db->fetch_row($res);
}
$ob['ban_ip'] == '' ? $ip = 'null' : ($ip = decode_ip($ob['ban_ip']));
$ob['ban_email'] == '' ? $ob['ban_email'] = 'null' : null;
// Dataarray
$todb = array('username' => $username, 'ip' => $ip, 'email' => $ob['ban_email']);
// Save data
insertdata('bans', $todb, __FILE__, __LINE__);
}
convredirect('ban_id', 'banlist', $last_id);
示例4: array
<?php
include '../includes/dbutil.php';
include 'includes/validation.php';
$parameters = array("user_name", "user_email", "password", "user_mobile", "device_id");
$is_parameter_available = is_post_parameters_exists($parameters);
if ($is_parameter_available == 0) {
extract($_POST);
$userprofile_count = get_row_count_by_condition("convention_users", "where user_email='" . $user_email . "'");
if ($userprofile_count <= 0) {
$password1 = md5($password);
$userdata = array('user_name' => $user_name, 'user_email' => $user_email, 'user_mobile' => $user_mobile, 'password' => $password1, 'device_id' => $device_id);
$isinserted = insertdata($userdata, "convention_users");
$result = selected_columns_by_condition("convention_users", "cnv_upid,user_email", "where user_email='" . $user_email . "'");
$result['status'] = 'success';
echo json_encode($result);
} else {
$result = selected_columns_by_condition("convention_users", "cnv_upid,user_email", "where user_email='" . $user_email . "'");
$result['status'] = 'success';
echo json_encode($result);
}
} else {
echo json_encode(array("status" => "failed"));
}
示例5: array
<?php
include '../includes/dbutil.php';
include 'includes/validation.php';
$parameters = array("user_name", "user_email", "fb_id", "device_id");
$is_parameter_available = is_post_parameters_exists($parameters);
if ($is_parameter_available == 0) {
extract($_POST);
$userprofile_count = get_row_count_by_condition("users", "where user_email='" . $user_email . "'");
if ($userprofile_count <= 0) {
$userdata = array('user_name' => $user_name, 'user_email' => $user_email, 'fb_id' => $fb_id, 'device_id' => $device_id);
$isinserted = insertdata($userdata, "users");
$result = selected_columns_by_condition("users", "upid,user_email", "where user_email='" . $user_email . "'");
$result['status'] = 'success';
echo json_encode($result);
} else {
$result = selected_columns_by_condition("users", "upid,user_email", "where user_email='" . $user_email . "'");
$result['status'] = 'success';
echo json_encode($result);
}
} else {
echo json_encode(array("status" => "failed"));
}
示例6: myerror
<?php
// Fetch category info
$result = $fdb->query('SELECT * FROM ' . $_SESSION['php'] . 'categories') or myerror('Unable to fetch categories', __FILE__, __LINE__, $fdb->error());
while ($ob = $fdb->fetch_assoc($result)) {
echo $ob['name'] . ' (' . $ob['ID_CAT'] . ")<br>\n";
flush();
// Dataarray
$todb = array('id' => $ob['ID_CAT'], 'cat_name' => $ob['name'], 'disp_position' => $ob['catOrder']);
// Save data
insertdata('categories', $todb, __FILE__, __LINE__);
}
// Redirect, don't check for more categories
echo '<script type="text/javascript">window.location="index.php?page=' . ++$_GET['page'] . '"</script>';
示例7: ceil
<?php
// Fetch user info
$res = $fdb->query('SELECT * FROM ' . $fdb->prefix . 'members WHERE ID_MEMBER>' . $start . ' ORDER BY ID_MEMBER LIMIT ' . ceil($_SESSION['limit'] / 5)) or myerror('Unable to fetch user info', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($res)) {
$last_id = $ob['ID_MEMBER'];
echo '<br>' . htmlspecialchars($ob['memberName']) . ' (' . $ob['ID_MEMBER'] . ")\n";
flush();
// Check for user/guest collision
if ($ob['ID_MEMBER'] == 1) {
// Fetch last user id
$last_result = $fdb->query('SELECT ID_MEMBER FROM ' . $fdb->prefix . "members ORDER BY ID_MEMBER DESC LIMIT 1") or myerror('Unable to fetch last user id', __FILE__, __LINE__, $fdb->error());
list($last_user_id) = $fdb->fetch_row($last_result);
$ob['ID_MEMBER'] = ++$last_user_id;
$_SESSION['admin_id'] = $ob['ID_MEMBER'];
}
// Dataarray
$todb = array('id' => $ob['ID_MEMBER'], 'username' => $ob['memberName'], 'password' => $ob['passwd'], 'url' => $ob['websiteUrl'], 'title' => $ob['usertitle'], 'icq' => $ob['ICQ'], 'aim' => $ob['AIM'], 'msn' => $ob['MSN'], 'yahoo' => $ob['YIM'], 'signature' => $ob['signature'], 'timezone' => $ob['timeOffset'], 'num_posts' => $ob['posts'], 'registered' => $ob['dateRegistered'], 'last_visit' => $ob['lastLogin'], 'email_setting' => $ob['hideEmail'], 'location' => $ob['location'], 'email' => $ob['emailAddress']);
if ($_SESSION['pun_version'] == '1.1') {
$todb['last_action'] = $ob['lastLogin'];
}
insertdata('users', $todb, __FILE__, __LINE__);
}
convredirect('ID_MEMBER', 'members', $last_id);
示例8: implode
} else {
$msg = "<div class='errordiv'>Please Upload image less than .</div>";
}
}
}
$images = implode(",", $val);
}
$usrData = array('upid' => $_SESSION['upid'], 'property' => $Property_for, 'property_type' => $property_type, 'contact_name' => $name, 'contact_mobile' => $mobile, 'contact_email' => $email, 'listed_by' => $listed, 'country' => $country, 'addres_state' => $state, 'addres_city' => $city, 'addres_locality' => $locality, 'address' => $address1, 'address_next' => $address2, 'name_project_society' => $Society);
if (isset($images)) {
$usrData['property_image'] = $images;
}
/*$pcount=get_row_count_by_condition("post_add","WHERE post_id=".$_SESSION['last_id']." and upid=".$_SESSION['upid']);*/
$issuccess = 0;
if (!isset($_POST['post_id'])) {
$usrData['exp_date'] = $exp_date;
insertdata($usrData, 'post_add');
$post_id = mysql_insert_id();
++$issuccess;
} else {
//update($usrData,'post_add',"WHERE id=".$_SESSION['last_id']." and upid=".$_SESSION['upid']);
unset($usrData['upid']);
$usrData['post_id'] = $post_id;
$usrData['property_image'] = isset($images) ? ',' . $usrData['property_image'] : '';
$sql = "UPDATE `post_add` SET `property`=:property,`property_image`=concat(property_image,:property_image),`property_type`=:property_type,`contact_name`=:contact_name,`contact_mobile`=:contact_mobile,`contact_email`=:contact_email,`listed_by`=:listed_by,`country`=:country,`addres_state`=:addres_state,`addres_city`=:addres_city,`addres_locality`=:addres_locality,`address`=:address,`address_next`=:address_next,`name_project_society`=:name_project_society WHERE `post_id` = :post_id";
$statement = $dbh->prepare($sql);
$statement->execute($usrData);
$post_id = $_POST['post_id'];
++$issuccess;
}
$result['status'] = $issuccess;
$result['post_id'] = $post_id;
示例9: get_row_count_by_condition
/* connect to database using mysqli */
//unset($_SESSION['token']);
//$user_exist = $mysqli->query("SELECT COUNT(google_id) as usercount FROM user_profile WHERE google_id=$user_id ")->fetch_object()->usercount;
$user_count = get_row_count_by_condition("users", "where user_email='" . $email . "'");
if ($user_count > 0) {
$user_info = get_row_by_condition("users", "where user_email='" . $email . "'");
$_SESSION['user_mobile'] = $user_info['user_mobile'];
$_SESSION['upid'] = $user_info['upid'];
$_SESSION['user_name'] = $user_info['user_name'];
$_SESSION['user_email'] = $user_info['user_email'];
//header("location:http://localhost/safe-wash/index.php");
} else {
//user is new
//echo 'Hi '.$user_name.', Thanks for Registering!';
$user_info1 = array('google_id' => $user_id, 'user_name' => $user_name, 'user_email' => $email);
$inserted = insertdata($user_info1, "users");
/*$mysqli->query("INSERT INTO user_profile (google_id, name, email)
VALUES ($user_id, '$user_name','$email')");*/
if ($inserted > 0) {
if (!isset($_SESSION['user_email'])) {
$user_info = get_row_by_condition("users", "where user_email='" . $email . "'");
$_SESSION['user_mobile'] = $user_info['user_mobile'];
$_SESSION['upid'] = $user_info['upid'];
$_SESSION['user_name'] = $user_info['user_name'];
$_SESSION['user_email'] = $user_info['user_email'];
}
}
}
}
?>
示例10: cjall
function cjall()
{
global $action, $rtype, $rpage, $rkey, $rday, $cjurl, $xt, $rid, $clflag;
if ($xt == "1") {
$url = $cjurl . "?ac=videolist&rid=" . $rid . "&pg=" . $rpage;
} else {
if ($xt == "2") {
$url = $cjurl . "?s=plus-api-xml-cms-ff-action-all-vodids--cid--play--inputer--wd--h-0-p-" . $rpage;
} else {
$url = $cjurl . "?action=cjall&rpage=" . $rpage;
}
}
insertdata($url, "cjall");
}
示例11: mysql_query
mysql_query("INSERT INTO " . $tabell . " VALUES('" . $idus . "','" . $idmnu . "','" . $qq[$c] . "')");
}
mysql_close();
} else {
$jml = count($arract);
for ($e = 0; $e < $jml; $e++) {
mysql_query("INSERT INTO " . $tabell . " VALUES(" . $idus . "," . $idmnu . "," . $arract[$e] . ")");
}
}
unset($_GET['idmn']);
} else {
if (returnm($idmnu, $idus, $tabell)) {
unset($_GET['idmn']);
} else {
$datacab = array('iduser' => $idus, 'idmenu' => $idmnu, 'idact' => '0');
insertdata($tabell, $datacab);
unset($_GET['idmn']);
}
}
}
?>
<form class="form-inline" action="<?php
$_SERVER['PHP_SELF'];
?>
" method="post" name="savemng">
<table class="table table-bordered text-center">
<tr>
<td rowspan="2">Nama User</td>
<td rowspan="2">Menu</td>
<td colspan="4">Capability</td>
<td rowspan="2">Aksi</td>
示例12: session_start
<?php
session_start();
include_once 'includes/dbutil.php';
extract($_POST);
$query = mysql_query("select * from post_add where upid='" . $_SESSION['upid'] . "' and post_id='" . $post_id . "'");
$count = mysql_num_rows($query);
if ($count > 0) {
$usrData = array('pets_allowed' => $pets, 'property_for' => $rent_for, 'description' => $pro_description, 'status' => 2);
$usrData1 = array('ac' => $ac, 'tv' => $tv, 'cupboard' => $cupboard, 'sofa' => $sofa, 'bed' => $bed, 'microwave' => $microwave, 'waching_machine' => $waching_machine, 'dining_table' => $dining_table, 'fridge' => $fridge, 'stove' => $stove, 'servent_room' => $servent_room, 'security' => $security, 'electricity_backup' => $electricity_backup, 'pooja_room' => $pooja_room, 'store_room' => $store_room, 'gym' => $gym, 'swimming_pool' => $swimming_pool, 'lift' => $lift, 'gas_pipeline' => $gas_pipeline);
$query1 = mysql_query("select * from post_add_amenties where upid='" . $_SESSION['upid'] . "' and post_id='" . $post_id . "'");
$count1 = mysql_num_rows($query1);
if ($count1 > 0) {
update($usrData1, 'post_add_amenties', 'where post_id=' . $post_id . ' and upid=' . $_SESSION['upid']);
} else {
$usrData1['post_id'] = $post_id;
$usrData1['upid'] = $_SESSION['upid'];
insertdata($usrData1, "post_add_amenties");
}
update($usrData, 'post_add', 'where post_id=' . $post_id . ' and upid=' . $_SESSION['upid']);
echo "<SCRIPT LANGUAGE='JavaScript'>\n\n \n\n window.location.href='index.php?message=1';\n\n </SCRIPT>";
} else {
header("location:post-add.php");
}
示例13: session_start
<?php
session_start();
include_once 'includes/dbutil.php';
extract($_POST);
$count = get_row_count_by_condition("users", "where fb_token='{$id}' and user_email='{$email}'");
if ($count > 0) {
$row = get_row_by_condition("users", "where user_email='{$email}'");
$_SESSION['upid'] = $row['upid'];
$_SESSION['user_name'] = $row['user_name'];
$result['status'] = "true";
echo json_encode($result);
} else {
$name = $first_name . " " . $last_name;
$userdata = array('user_name' => $name, 'fb_token' => $id, 'user_email' => $email);
$isupdated = insertdata($userdata, "users");
if ($isupdated > 0) {
$row1 = get_row_by_condition("users", "where user_email='{$email}'");
$_SESSION['upid'] = $row1['upid'];
$_SESSION['user_name'] = $row1['user_name'];
$result['status'] = "true";
echo json_encode($result);
}
}
示例14: session_start
<?php
session_start();
include_once 'includes/dbutil.php';
extract($_POST);
$count = get_row_count_by_condition('convention_users', 'where user_email="' . $emailid . '"');
if ($count == 0) {
if ($password != $conformpassword) {
$_SESSION['msg'] = '<div style="color:green">password and conform password not match....</div>';
header('location:index.php');
exit;
}
$password1 = md5($password);
$usrData = array('user_name' => $username, 'user_email' => $emailid, 'user_mobile' => $mobileno, 'password' => $password1);
$user = insertdata($usrData, 'convention_users');
if ($user) {
$_SESSION['msg'] = '<div style="color:green">User successfully registered....</div>';
//header('location:convention-centre.php');
/*echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('vendor created successfully...');
window.location.href='index.php';</SCRIPT>");*/
} else {
$_SESSION['msg'] = '<div style="color:red">User not registered....</div>';
//header('location:index.php');
/*echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('You entered incorrect Username or Password ')
window.location.href='index.php';
</SCRIPT>");*/
示例15: myerror
<?php
// Fetch topic info
$result = $fdb->query('SELECT * FROM ' . $fdb->prefix . 'topics WHERE tid > ' . $start . ' ORDER BY tid LIMIT ' . $_SESSION['limit']) or myerror('Unable to get topic info', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['tid'];
echo htmlspecialchars($ob['title']) . ' (' . $ob['tid'] . ")<br>\n";
flush();
// Check id=1 collisions
$ob['starter_id'] == 1 ? $ob['starter_id'] = $_SESSION['admin_id'] : null;
$ob['last_poster_id'] == 1 ? $ob['last_poster_id'] = $_SESSION['admin_id'] : null;
$ob['last_poster_name'] == '' || $ob['last_poster_name'] == null ? $ob['last_poster_name'] = 'null' : null;
// Fetch last_post_id
$res = $fdb->query('SELECT pid FROM ' . $fdb->prefix . 'posts WHERE topic_id=' . $ob['tid'] . ' ORDER BY pid DESC LIMIT 1') or myerror('Unable to get last_post_id', __FILE__, __LINE__, $fdb->error());
$ob['last_post_id'] = $fdb->num_rows($res) > 0 ? $fdb->result($res, 0) : null;
// Dataarray
$todb = array('id' => $ob['tid'], 'poster' => $ob['starter_name'], 'subject' => $ob['title'], 'posted' => $ob['start_date'], 'num_views' => $ob['views'], 'num_replies' => $ob['posts'], 'last_post' => $ob['last_post'], 'last_post_id' => $ob['last_post_id'], 'last_poster' => $ob['last_poster_name'], 'sticky' => $ob['pinned'], 'forum_id' => $ob['forum_id']);
// Save data
insertdata('topics', $todb, __FILE__, __LINE__);
}
convredirect('tid', 'topics', $last_id);