Ejemplo n.º 1
0
<?php

include "connect.php";
$database = new cbSQLConnect($databaseSetup, cbSQLConnectVar::FETCH_ASSOC);
// Get my bookmarks
$datas = $database->QuerySingle("SELECT * FROM bookmarks WHERE estado = '1' ORDER BY orden DESC ");
$var = '';
foreach ($datas as $value) {
    $var .= "\n\t\t<li class='ui-state-default' id='order-" . $value['id'] . "'>\n\t\t<input type='checkbox' class='checkbox' id='cb-" . $value['id'] . "'>\n\t\t<a href='" . $value['url'] . "' target='_blank'>" . $value['url'] . "</a>\n\t\t<img class='edit-ico' id='img-" . $value['id'] . "' src='img/edit-icon.png'>\n\t\t</li>";
}
echo $var;
Ejemplo n.º 2
0
<?php

include "connect.php";
$database = new cbSQLConnect($databaseSetup, cbSQLConnectVar::FETCH_ASSOC);
$date = date('Y-m-d H:i:s');
$id = str_replace('img-', '', $_POST["id"]);
$url = $_POST["url"];
if (!empty($id)) {
    $database->SQLUpdate("bookmarks", "url", $url, "id", $id);
} else {
    // Count rows for order
    $count = $database->QuerySingle("SELECT count(*) AS total FROM bookmarks");
    $insert = $database->SQLInsert(array(array('id' => null, 'url' => $url, 'fecha' => $date, 'orden' => (int) $count[0]['total'] + 1, 'estado' => '1')), "bookmarks");
    // return true if sucess or false
    echo $insert;
}