function deletFrom($table, $id)
{
    $insert = "DELETE FROM " . $table . " WHERE id=" . $id . ";";
    runInsert($insert);
}
Example #2
0
<?php

require_once '../../config/config.php';
require_once $serverPath . 'utils/requireLogin.php';
require_once $serverPath . 'utils/dataUpdateInsert.php';
//Simple enough will delete a credit card of the logged in user given an id from the url
if (!empty($_GET['id'])) {
    $table = "cc_info";
    $insert = "DELETE FROM " . $table . " WHERE id=" . $_GET['id'] . " AND user_id=" . $_SESSION['user']['id'] . ";";
    runInsert($insert);
}
Example #3
0
function deleteFrom($table, $id)
{
    $insert = "DELETE FROM " . getTableQuote($table) . " WHERE id=" . $id . ";";
    runInsert($insert);
}
Example #4
0
$table = "messages";
if (!empty($_POST)) {
    $data = ['message' => $_POST['message'], 'sent_to' => $_POST['services.user_id'], 'sent_from' => $_SESSION['user']['id']];
    if (empty($_GET['id'])) {
        insert($table, $data);
        $added = true;
        header("Location: index.php");
        die("Redirecting to index.php");
    } else {
        //Normal update cannot be used here becuase it would allow anyone who is logged in to update anyone elses prank
        $update = "UPDATE " . $table . " SET ";
        foreach ($data as $columnName => $value) {
            $update .= $columnName . "='" . $value . "', ";
        }
        $update = substr($update, 0, strlen($update) - 2) . " WHERE id=" . $_GET['id'] . " AND user_id=" . $_SESSION['user']['id'] . ";";
        runInsert($update);
        header("Location: index.php");
        die("Redirecting to index.php");
    }
}
?>
<div class="container-fluid">
		<div class="panel panel-default">
			<div class="panel-heading clearfix">
				<h3 class="panel-title pull-left">My Messages</h3>
				</div>
				<div class="panel-body">
				<p>Here is where messages will go between <?php 
$query1 = 'select prank.user_id, services.user_id from services inner join prank on services.prank_id=prank.id where services.user_id=' . $_SESSION['user']['id'] . ';';
$results1 = runQuery($query1);
echo json_encode($results1);
Example #5
0
function importMenuData($menuData)
{
    global $table;
    foreach ($menuData as $menuDataRow) {
        $currentMenuItem = findByProperty($table, "name", $menuDataRow['name']);
        if ($currentMenuItem == null) {
            $menuItemImportOrUpdateStatement = getMenuItemImportStatement($menuDataRow);
        } else {
            $menuItemImportOrUpdateStatement = getMenuUpdateStatement($menuDataRow);
        }
        runInsert($menuItemImportOrUpdateStatement);
    }
}