Skip to content

Instantly share code, notes, and snippets.

@facumartig
facumartig / date2.php
Last active December 20, 2015 02:18 — forked from ricardosiri68/date2.php
<?php
require_once 'config/db_config.php';
$sql = "SELECT *, DATE_FORMAT(timestamp, '%Y-%c-%e') selector FROM events WHERE DATE_FORMAT(timestamp, '%Y-%c') = '".$_POST['d']."' ORDER BY timestamp, id ASC";
$query = mysqli_query($link, $sql);
if (mysqli_num_rows($query) > 0){
$data = array();
while ($recset = mysqli_fetch_array($query)){
if(!array_key_exists($recset["selector"], $data)){
$(function() {
tbody = $("tbody");
$.ajax({
dataType: "json",
type: "POST",
data: { action: "select" },
url: "./php/events_table.php",
beforeSend: function() { tbody.html("<td colspan=\"4\" style=\"text-align: center; padding: 50px 0px;\">Loading events...</td>"); },
success: function(data) {
getEventsTable(data);