Exemplo n.º 1
0
<<<<<<< HEAD
<?php 
include 'template/header.php';
include 'template/menu.php';
include 'inc/functions.php';
$link = get_database_connection();
$db_connect = get_database_connection();
mysqli_select_db($db_connect, $DBNAME) or die("cannot select DB");
$sql = mysqli_query($db_connect, "SELECT * FROM tbl_admin_user WHERE id = '1' ");
while ($row = mysqli_fetch_assoc($sql)) {
    var_dump($row);
}
echo "####>>" . mysqli_insert_id($db_connect);
/*$bundle = mysqli_fetch_assoc($sql);

  var_dump($bundle);*/
/*$all_fish_bundle = all_bundle();

if(!empty($_GET['confirm'])){

    if($_GET['confirm']=='confirm')
      $message = "Your order has been confirmed.We will contact soon..";

    if($_GET['confirm']=='error')
      $errormessage = "Something wrong.Please Try again!!";
}*/
?>
   


Exemplo n.º 2
0
function update_employe($employe_id, $name, $designation, $department, $sex, $phone, $address, $join_date)
{
    global $DBNAME;
    $db_connect = get_database_connection();
    mysqli_select_db($db_connect, $DBNAME) or die("cannot slect DB");
    $address = input_text_validation($address);
    $now = date('Y-m-d H:i:s');
    $sql = mysqli_query($db_connect, "UPDATE " . EMPLOYE . " SET name='{$name}', designation='{$designation}', department= '{$department}', sex= '{$sex}', phone = '{$phone}', address = '{$address}', join_date= '{$join_date}', updated_at = '{$now}' WHERE id = '{$employe_id}' ");
    if ($sql) {
        return 1;
    } else {
        return 0;
    }
}
Exemplo n.º 3
0
function custom_bundle_create($element, $item_counter)
{
    global $DBNAME;
    $db_connect = get_database_connection();
    mysql_select_db($DBNAME) or die("cannot slect DB");
    $sql = mysql_query("SELECT id,fish_code, fish_name FROM tbl_fishes");
    $bundle_weight = 0;
    $bundle_price = 0;
    for ($i = 1; $i <= $item_counter; $i++) {
        $bundle_element[] = array('fish_id' => $element[$i][1], 'weight' => $element[$i][2]);
        $fish_id = $element[$i][1];
        $weight = $element[$i][2];
        $sql = mysql_query("SELECT unit_price FROM tbl_fishes WHERE id= '{$fish_id}'");
        $row = mysql_fetch_assoc($sql);
        $bundle_weight = $bundle_weight + $weight;
        $bundle_price = $bundle_price + $weight * $row['unit_price'];
    }
    $bundle_name = "Custom Order";
    $bundle_image_url = "";
    $bundle_element = serialize($bundle_element);
    $quantity = $item_counter;
    $sql = mysql_query("INSERT INTO tbl_fish_bundles (bundle_name, bundle_element, bundle_price , bundle_weight,quantity,bundle_image_url ) VALUES ('{$bundle_name}', '{$bundle_element}', '{$bundle_price}', '{$bundle_weight}','{$quantity}','{$bundle_image_url}')");
    if ($sql) {
        return mysql_insert_id();
    } else {
        return false;
    }
}
Exemplo n.º 4
0
<?php

if (!defined("allow_inc")) {
    die("You can't access this file directly.");
}
session_start();
$dbc = get_database_connection();
$user = false;
$profile = true;
$page = "page_home.php";
if (isset($_SESSION["user"])) {
    if ($query = $dbc->query("SELECT * FROM `users` LEFT JOIN `profiles` ON `users`.`uid` = `profiles`.`uid` WHERE `users`.`uid` = '{$_SESSION["user"]}'")) {
        if ($row = $query->fetch_assoc()) {
            $user = $row;
            if ($user["uid"] === NULL) {
                // this means the user profile is not set up
                $user["uid"] = $_SESSION["user"];
                $profile = false;
            }
        }
    }
}
if (isset($_GET["page"])) {
    $page = "page_" . $_GET["page"] . ".php";
}
if (!file_exists($page)) {
    $page = "page_notfound.php";
}
// US States
$us_states = array("AL" => "Alabama", "AK" => "Alaska", "AZ" => "Arizona", "AR" => "Arkansas", "CA" => "California", "CO" => "Colorado", "CT" => "Connecticut", "DE" => "Delaware", "DC" => "District of Columbia", "FL" => "Florida", "GA" => "Georgia", "HI" => "Hawaii", "ID" => "Idaho", "IL" => "Illinois", "IN" => "Indiana", "IA" => "Iowa", "KS" => "Kansas", "KY" => "Kentucky", "LA" => "Louisiana", "ME" => "Maine", "MD" => "Maryland", "MA" => "Massachusetts", "MI" => "Michigan", "MN" => "Minnesota", "MS" => "Mississippi", "MO" => "Missouri", "MT" => "Montana", "NE" => "Nebraska", "NV" => "Nevada", "NH" => "New Hampshire", "NJ" => "New Jersey", "NM" => "New Mexico", "NY" => "New York", "NC" => "North Carolina", "ND" => "North Dakota", "OH" => "Ohio", "OK" => "Oklahoma", "OR" => "Oregon", "PA" => "Pennsylvania", "RI" => "Rhode Island", "SC" => "South Carolina", "SD" => "South Dakota", "TN" => "Tennessee", "TX" => "Texas", "UT" => "Utah", "VT" => "Vermont", "VA" => "Virginia", "WA" => "Washington", "WV" => "West Virginia", "WI" => "Wisconsin", "WY" => "Wyoming");
function isPosted()
Exemplo n.º 5
0
/**
 * Sets the supplied module_id completed/open based on $flag.
 * Must be validated.
 *
 * @param $module_id
 * @param $flag
 */
function set_completed_flag_on_module($module_id, $flag)
{
    $db = get_database_connection();
    $sth = $db->prepare('UPDATE user_module SET completed = ? WHERE module_id = ? AND user_id = ?');
    $sth->execute([$flag, $module_id, CURRENT_USER_ID]);
    if (!$sth->rowCount()) {
        $sth = $db->prepare('INSERT INTO user_module SET completed = ?, module_id = ?, user_id = ?');
        $sth->execute([$flag, $module_id, CURRENT_USER_ID]);
    }
}
Exemplo n.º 6
0
function delete_category($category_id)
{
    global $DBNAME;
    $db_connect = get_database_connection();
    mysqli_select_db($db_connect, $DBNAME) or die("Cannot select DB");
    $sql = mysqli_query($db_connect, "DELETE  FROM tbl_categories WHERE category_id = {$category_id}");
    if ($sql) {
        return 1;
    } else {
        return 0;
    }
}