Example #1
0
 public function loadByID($id = -1)
 {
     if ($id != 0) {
         $query = "SELECT * FROM {$this->table_name} WHERE {$this->key_field} = :id ";
         $params["id"] = $id;
         $results = Database::Results($query, $params);
         if (count($results) > 0) {
             $this->data = $results[0];
             return $this->data;
         } else {
             return array();
         }
     } else {
         return array();
     }
 }
        <div class="vndc_easy-separator"></div>
        	
        EOT;
        	
        	fwrite($fp, $content2);
        	fclose($fp);
        	exit;*/
        Redirect("/crudgen/make_form?Message=" . urlencode("You have created your datalist."));
    }
}
$Message = Request::Field("Message");
if ($table_created != "") {
    $primaryKey = "";
    $Columns = array();
    $query = "SELECT * FROM {$table_created} LIMIT 1";
    $resultset = Database::Results($query);
    foreach ($resultset as $GetItem) {
        $i = 0;
        foreach ($GetItem as $key => $value) {
            if ($i == 0) {
                $primaryKey = $key;
            }
            $Columns[] = $key;
            $i++;
        }
        break;
    }
}
$table_created = isset($_SESSION['crudgen']['table_created']) ? $_SESSION['crudgen']['table_created'] : "";
$Smarty->assign("table_created", $table_created);
$Smarty->assign("TableColumns", $Columns);
Example #3
0
<?php

setcookie("ck_authorized", "true", 0, "/");
$vnd_id = intval(Request::Field("vnd_id"));
$query = "\nSELECT * FROM vnd_cms WHERE vnd_id = :vnd_id ";
$data = array();
$data['vnd_id'] = $vnd_id;
$Page = Database::Results($query, $data);
if (is_array($Page)) {
    $MyPage = $Page[0];
} else {
    $MyPage = array();
}
# Render if authorized, otherwise, not.
if (!Security::Authorized()) {
    Page::Redirect("login", "You must be logged in!");
}
$Smarty->assign("Page", $MyPage);
$Smarty->display('dashboard/cms/edit.tpl');
<?php

include "../includes/Includes.php";
$order_id = 1;
$query = "\nSELECT * FROM vnd_order_details WHERE vnd_order_id = :order_id ";
$data = array();
$data['order_id'] = $order_id;
$resultset = Database::Results($query, $data);
echo json_encode($resultset);
Example #5
0
<?php

$query = "\nSELECT * FROM vnd_cms\nORDER BY vnd_page_name ";
$Pages = Database::Results($query);
if (!is_array($Pages)) {
    $Pages = array();
}
$i = 0;
foreach ($Pages as $GetPage) {
    $Pages[$i]['vnd_entrydate'] = show_date($GetPage['vnd_entrydate']);
    $i++;
}
# Render if authorized, otherwise, not.
if (!Security::Authorized()) {
    Page::Redirect("login", "You must be logged in!");
}
$Smarty->assign("Pages", $Pages);
$Smarty->display('dashboard/cms/pages.tpl');