Fullcalendar not showing up events - PHP mysql - php

I am using the Full calendar in my PHP application. But the issue is that events don't show up in the calendar.
Calendar.php -
<?php
$host = "localhost";
$user = "myusername";
$pw = "mypass";
$database = "mydb";
$db = mysql_connect($host,$user,$pw)
or die("Cannot connect to mySQL.");
mysql_select_db($database,$db)
or die("Cannot connect to database.");
$year = date('Y');
$month = date('m');
$command = "SELECT * FROM `calendar_urls` ";
$result = mysql_query($command, $db);
while ($row = mysql_fetch_assoc($result)) {
$url = $row['calendar_array'];
$urls[] = $url;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar.print.css' media='print' />
<script type='text/javascript' src='jquery/jquery-1.7.1.min.js'></script>
<script type='text/javascript' src='jquery/jquery-ui-1.8.17.custom.min.js'></script>
<script type='text/javascript' src='fullcalendar/fullcalendar.min.js'></script>
<script type='text/javascript' src='fullcalendar/gcal.js'></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: 'month,basicWeek,basicDay'
},
editable: true,
//events: 'https://www.google.com/calendar/feeds/kelchuk68%40gmail.com/public/basic/',
eventSources: [
//get_string(),
/*'https://www.google.com/calendar/feeds/kelchuk68%40gmail.com/public/basic',
'events.php',*/
<?php echo implode(",", $urls); ?>
]
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 14px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div style="display:block; width:900px; margin: 0 auto; ">
<div style="float:right; margin-bottom:10px;">
<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post">
<input type="submit" name="add_event" value="Add Event"/>
</form>
<p style="display:none">Add Event | Edit Event | Delete Event</p></div>
</div>
<div style="clear:both;"></div>
<?php if($_POST['add_event']){
$year = date("Y");
$year2= $year + 1;
$mymonth = date("m");
$day = date("d");?>
<div style="background-color:grey; width:900px; margin:0 auto;padding-top:20px;padding-bottom:10px; border-radius:15px;">
<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post">
<div style="float:left;margin-left:10px;">Title: <input style="margin:0 auto; text-align:left;" type="text" name="event_title" value=""/>
<select name ="year">
<?php echo '<option selected="selected">'.$year.'</option>';
echo '<option>'.$year2.'</option>';
echo '</select>';
?>
<select name ="month">
<?php
$month = array($month);
echo '<option selected="selected">'.$mymonth.'</option>';
$months = array('01','02','03','04','05','06','07','08','09','10','11','12');
$months = array_diff($months,$month);
foreach($months as $month_opt){
echo '<option>'.$month_opt.'</option>';
}
echo '</select>';
?>
<select name="day">
<?php echo '<option selected="selected">'.$day.'</option>';
for($i=1; $i<32; $i++) {
echo '<option>'.$i.'</option>';
}
echo '</select>';
?>
&nbsp Hour: <select name="hour">
<?php
$hours = array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23');
foreach($hours as $hour){
echo '<option>'.$hour.'</option>';
}
echo '</select>';
?>
&nbsp Minutes: <select name="minutes">
<?php
$minutes = array('00','15','30','45');
foreach($minutes as $minute){
echo '<option>'.$minute.'</option>';
}
echo '</select>';
echo'</div>';
?><br/><br/>
<div style="float:left;margin-left:10px;margin-bottom:5px;">Notes:</div>
<textarea name="notes" style="width:880px; margin:0 auto;"></textarea><br/>
<?php
echo '<input style="margin-top:10px;" type="submit" name="adding" value="Add the Event"/></form></div><br/><br/>';
}
if($_POST['adding']) {
$year = $_POST['year'];
$month = $_POST['month'];
$day= $_POST['day'];
$hour= $_POST['hour'];
$minutes= $_POST['minutes'];
$fulldate = $year."-".$month."-".$day." ".$hour.":".$minutes;
$command = "INSERT INTO calendar VALUES('','0', '{$_POST['event_title']}', '{$_POST['notes']}', '$fulldate','') ";
$result = mysql_query($command, $db);
if($result) {
echo "Successful Insert!";
}
}
?>
<div style="clear:both;"></div>
<div id='calendar'></div>
</body>
</html>
The calendar shows up properly. Also it lets user add events but those events are not displayed.
The 2 tables which are used by the calendar contain the following -
This is my events.php-
<?php
session_start();
date_default_timezone_set('Asia/Calcutta');
include ("connect.inc");
$db = public_db_connect();
$year = date('Y');
$month = date('m');
$command = "SELECT * FROM `calendar`";
$result = mysql_query($command, $db);
while ($row = mysql_fetch_assoc($result)) {
//echo "hi";
//$start = date("D, j M Y G:i:s T", strtotime($row['start']));
//$end = date("D, j M Y G:i:s T", strtotime($row['end_time']));
$start = date("Y-m-d", strtotime($row['start']));
//$start = "$year-$month-20";
$myid = $row['id'];
$eventsArray['id'] = (int)trim($myid);
$eventsArray['title'] = $row['title'];
$title = date("g:ia", strtotime($row['start']))." ".$row['title'];
//$title = $row['title'];
//echo $title;
$eventsArray['title'] = $title;
$eventsArray['start'] = $start;
/*$eventsArray['end'] = $start;*/
$eventsArray['url'] = "edit_calendar.php?calendarid=".$row['id'];
// $eventsArray['end'] = $end;
// $eventsArray['allDay'] = false;
$events[] = $eventsArray;
}
echo json_encode($events);
Connect.inc -
<?php
function public_db_connect() {
$host = "localhost";
$user = "myuser";
$pw = "mypass";
$database = "mydb";
$db = mysql_connect($host,$user,$pw)
or die("Cannot connect to mySQL.");
mysql_select_db($database,$db)
or die("Cannot connect to database.");
return $db;
}
?>
I don't know what that calendar URL is for and why it has some google link as it came from the site I downloaded this calendar.
Thanks.

Related

Windows time in MySQL

I have a datetime variable in MySQL. Now it's 15:36 14-09-2021 on my computer, but when I store it to MySQL there is 09:36 2021-09-14. What can I do to display it in a way which takes into account Windows time? Do you know how to do that? Do you have any ideas?
This is my current code:
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div>
<a href="index.php">
<img id="logo" src="logo.png" width="100px" height="100px" style="margin-left: 400px;">
</a>
</div>
<?php
$connection = mysqli_connect("XXX", "XXX", "XXX", "XXX");
if (isset($_POST['answer'])) {
$stmt = mysqli_prepare($connection, "INSERT INTO answers(questionId, dateAndTime, answer) VALUES (?,(SELECT now()),?)");
$stmt->bind_param("ss", $a, $b);
$a = $_SESSION['id'];
$b = $_POST['answer'];
$stmt->execute();
}
if (isset($_GET['id'])) {
$stmt = mysqli_prepare($connection, "SELECT posts.title,posts.body,posts.dateAndTime FROM posts WHERE posts.id=?");
$stmt->bind_param("s", $id);
$id = $_GET['id'];
$_SESSION['id'] = $id;
$stmt->execute();
$result = $stmt->get_result();
while ($row = mysqli_fetch_assoc($result)) {
echo '<div style="display: flex;"><div>', $row['dateAndTime'], '</div><div style="font-size: 42px;">', $row['title'], "</div></div><div>", $row['body'], "</div>";
}
} else {
$stmt = mysqli_prepare($connection, "SELECT posts.title,posts.body,posts.dateAndTime FROM posts WHERE posts.id=?");
$stmt->bind_param("s", $id);
$id = $_SESSION['id'];
$stmt->execute();
$result = $stmt->get_result();
while ($row = mysqli_fetch_assoc($result)) {
echo '<div style="display: flex;"><div>', $row['dateAndTime'], '</div><div style="font-size: 42px;">', $row['title'], "</div></div><div>", $row['body'], "</div>";
}
} {
$stmt = mysqli_prepare($connection, "SELECT answers.answer, answers.dateAndTime FROM answers WHERE answers.questionId=?");
$stmt->bind_param("s", $id);
$stmt->execute();
$result = $stmt->get_result();
while ($row = mysqli_fetch_assoc($result)) {
echo '<div style="border-style: solid; margin: 5px; display: inline-block;"><div style="display:flex;"><div>', $row['dateAndTime'], '</div><div style="margin: 5px;">', $row['answer'], "</div></div></div><br>";
}
}
?>
<form action="question.php" method="POST" style="display: flex; flex-direction: column;">
<textarea name="answer" style="margin-top: 100px; width: 25%; height: 200px;"></textarea>
<button type="submit" class="btn" style=" width: 5%; text-align: center;">Answer</button>
<input type='hidden' value='send' name='first'>
</form>
</body>
</html>
First use the following javascript code:
<script>
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
document.cookie = escape(name) + "=" + escape(value) + expires + "; path=/";
}
createCookie("timeZone", Intl.DateTimeFormat().resolvedOptions().timeZone, "10");
</script>
And than just use the following code in PHP:
$date = new DateTime($row['dateAndTime'], new DateTimeZone(date_default_timezone_get()));
$date->setTimezone(new DateTimeZone($_COOKIE["timeZone"]));
$date->format('Y-m-d H:i:s')

PHP: global variable not being stored?

It turns out this has nothing to do with global variables (sorry discussed in another post).
I was trying to keep all the code on one page (self-processing), but I'm pretty sure it's not possible. Arranging the following code outlined in the answer below, on the same page, does not work. Figures.
*edited to add the whole script minus the CSS (unnecessary).
<!DOCTYPE html>
<head>
<title>Inventory Tables</title>
</head>
<style></style>
<body>
<?php //IRCinventoryhome.php
require("IRCpage.inc");
require_once 'IRCinventoryconfig.php';
$homepage = new IRCtemplate();
$homepage->Display();
session_start();
?>
<!-- Dropdown Menu for Table Selection -->
<div id="contentHeader">
<?php //Menu for table selection
ini_set('display_errors',1); error_reporting(E_ALL);
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database);
if ($connection->connect_error) die($connection->connect_error);
$result = $connection->query("SHOW TABLES");
$table = array();
while ($row = $result->fetch_row()){
$table[] = $row[0];
}
$count = count($table);
?>
<div id="select">
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST">
<select name="value">
<?php for ($pointer = 0 ; $pointer < $count ; ++$pointer) {
echo <<<_END
<pre>
<option value="$table[$pointer]">$table[$pointer]</option>
</pre>
_END;
}
?>
</select>
<input type="submit" value="go">
</form>
</div> <!-- End .select -->
</div> <!-- End #contentHeader -->
<div id="content">
<!-- Code for Database Tables and Actions -->
<?php //inventory mysql tables
if (($_SERVER['REQUEST_METHOD'] == 'POST') && isset($_POST['value'])) {
$thisTable = $_POST['value'];
global $thisTable;
ini_set('display_errors',1); error_reporting(E_ALL);
$queryColumns = "SHOW COLUMNS FROM $thisTable";
$resultColumns = $connection->query($queryColumns);
if (!$resultColumns) die ("Database access failed: " . $connection->error);
$columns = array();
while ($column = $resultColumns->fetch_row()){
$columns[] = $column[0];
}
echo "<div id=\"table\"><table class=\"CSSTableGenerator\" >\n";
$count = count($columns);
$insertColumns = array();
for ($pointer = 1 ; $pointer < $count ; ++$pointer) {
$insertColumns[] = $columns[$pointer];
}
for ($pointer = 0 ; $pointer < $count ; ++$pointer) {
echo "<th scope=\"col\" bgcolor=\"#efefef\">";
echo $columns[$pointer];
echo "</th>";
}
echo "<th>ACTIONS</td>";
$queryRows = "SELECT * FROM $thisTable";
$resultRows = $connection->query($queryRows);
if (!$resultRows) die ("Database access failed: " . $connection->error);
$rows = $resultRows->num_rows;
for ($j = 0 ; $j < $rows ; ++$j)
{
$resultRows->data_seek($j);
$row = $resultRows->fetch_array(MYSQLI_NUM);
$count = count($row);
echo "<tr>";
for ($pointer = 0 ; $pointer < $count ; ++$pointer) {
echo "<td>";
echo $row[$pointer];
echo "</td>";
}
?>
<td>
<input action="<?php echo $_SERVER['PHP_SELF']?>" type="submit" value="edit" name="edit">
<input action="<?php echo $_SERVER['PHP_SELF']?>" type="submit" value="delete" name="delete">
</td>
</tr>
<?php
}
echo "</table></div>"; //end table, end content
$connection->close();
}
?>
<!-- FORM FOR ADDING ROWS TO CURRENT TABLE -->
<div id="table">
<table id="formTable">
<form name="addRow" action="<?php echo $_SERVER['PHP_SELF']?>" method="POST">
<input type="hidden" name="control">
<td>
Add row?
</td>
<?php for ($pointer = 1 ; $pointer < $count ; ++$pointer) { ?>
<td>
<input type="text" name="<?php echo $columns[$pointer];?>">
</td>
<?php } ?>
<td>
<input type="submit" value="go">
</td>
</form>
</table>
</div> <!-- end form, end table, end content -->
<?php
global $thisTable;
echo $thisTable;
if (isset($_POST['control'])) {
global $thisTable;
echo $thisTable;
$valuesArray = array();
if (isset($_POST)) {
$valuesArray = $_POST;
}
$columnsArray = array_keys($valuesArray);
//array_splice($columnsArray, 0, 1);
$columnsString = implode(", ", $columnsArray);
print_r($columnsString);
$insertValues = array();
foreach($valuesArray as $values) {
$insertValues[] = $values;
}
$valuesString = implode(" ", $insertValues);
$valuesString = "'".$valuesString."'";
$valuesString = str_replace(" ", "', '", $valuesString);
$valuesString = substr($valuesString, 3);
print_r($valuesString);
/*
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database);
if ($connection->connect_error) die($connection->connect_error);
$queryInsert = "INSERT INTO $thisTable ($columnsString) VALUES ($valuesString)";
$result = $connection->query($queryInsert);
if (!$result) echo "INSERT failed: $query<br>" .
$connection->error . "<br><br>";
$connection->close();
*/
}
?>
</div> <!-- End #content -->
</body>
</html>
After 20 hours or so I'm still not sure if this possible to do all on the same page. But this solution works...
Page one:
<!DOCTYPE html>
<head>
<title>Interactive Resource Center Inventory</title>
<meta charset="UTF-8">
</head>
<script src="../_js/jquery.min.js"></script>
<script src="../_js/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$('form').submit(function() {
$('input[type=submit]')
prop('disabled',true);
});//end submit
var max_fields = 4; //maximum input boxes allowed
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var x = 1; //initlal text box count
$(add_button).click(function(e){ //on add input button click
e.preventDefault();
if(x < max_fields){ //max input box allowed
x++; //text box increment
$(wrapper).append('<div>Column: <input type="text" name="mytext[]"/>Remove</div>'); //add input box
}
});
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
e.preventDefault(); $(this).parent('div').remove(); x--;
})
});//end ready
</script>
<style>
#table {
margin-top:2px;
}
#formTable {
width:100%;
margin:0px;padding:0px;
border:1px solid #000000;
border-bottom:none;
border-left:none;
border-right:none;
}
#formTable td{
vertical-align:middle;
border:1px solid #000000;
border-width:0px 1px 1px 0px;
text-align:left;
padding:7px;
width:100px;
font-size:14px;
font-family:arial;
font-weight:normal;
color:#000000;
}
#formTable input[type="text"]{
width:95%;
}
.CSSTableGenerator {
margin:0px;padding:0px;
width:100%;
border:1px solid #000000;
border-top:none;
border-right:none;
border-left:none;
}
.CSSTableGenerator table{
width:100%;
height:100%;
margin:0px;padding:0px;
}
.CSSTableGenerator tr:nth-child(odd){ background-color:#e5e5e5; }
.CSSTableGenerator tr:nth-child(even) { background-color:#ffffff; }
.CSSTableGenerator th{
border:1px solid #000000;
border-width:0px 1px 1px 0px;
width:100px;
}
.CSSTableGenerator td{
vertical-align:middle;
border:1px solid #000000;
border-width:0px 1px 1px 0px;
text-align:left;
padding:7px;
width:100px;
font-size:14px;
font-family:arial;
font-weight:normal;
color:#000000;
}
.CSSTableGenerator tr:last-child td{
border-width:0px 1px 0px 0px;
}
.CSSTableGenerator tr td:last-child{
border-width:0px 0px 1px 0px;
}
.CSSTableGenerator tr:last-child td:last-child{
border-width:0px 0px 0px 0px;
}
.CSSTableGenerator tr:first-child td{
background:-o-linear-gradient(bottom, #cccccc 5%, #b2b2b2 100%); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #b2b2b2) ); background:-moz-linear-gradient( center top, #cccccc 5%, #b2b2b2 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#b2b2b2"); background: -o-linear-gradient(top,#cccccc,b2b2b2);
background-color:#cccccc;
border:0px solid #000000;
text-align:center;
border-width:0px 0px 1px 1px;
font-size:14px;
font-family:arial;
font-weight:bold;
color:#000000;
margin-top:-2px;
</style>
<body>
<?php //IRCinventoryhome.php
require("IRCpage.inc");
require("IRCinventoryfunctions.php");
require_once 'IRCinventoryconfig.php';
$homepage = new IRCtemplate();
$homepage->Display();
session_start();
$_SESSION['value'] = $_POST['value'];
$thisTable = $_SESSION['value'];
var_dump($_SESSION);
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database, $db_port);
if ($connection->connect_error) die($connection->connect_error);
global $connection;
$result = $connection->query("SHOW TABLES");
$table = array();
while ($row = $result->fetch_row()){
$table[] = $row[0];
}
$count = count($table);
?>
<!-- Dropdown Menu for Table Selection -->
<div id="contentHeader">
<div id="select">
<form action="http://localhost:8888/IRC/IRCinventoryhometest.php" method="POST">
<select name="value">
<?php for ($pointer = 0 ; $pointer < $count ; ++$pointer) {
echo <<<_END
<pre>
<option value="$table[$pointer]">$table[$pointer]</option>
</pre>
_END;
}
?>
</select>
<input type="submit" name="go">
</form>
</div> <!-- End .select -->
</div> <!-- End #contentHeader -->
<div id="content">
<?php
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$thisTable = "OUTGOING";
$queryColumns = "SHOW COLUMNS FROM $thisTable";
$resultColumns = $connection->query($queryColumns);
if (!$resultColumns) die ("Database access failed: " . $connection->error);
global $resultColumns;
$queryRows = "SELECT * FROM $thisTable";
$resultRows = $connection->query($queryRows);
if (!$resultRows) die ("Database access failed: " . $connection->error);
global $resultRows;
$rows = $resultRows->num_rows;
global $rows;
global $connection;
drawTable();
$connection->close();
} else {
if(isset($_POST['value'])) {
$thisTable = $_POST['value'];
}
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database, $db_port);
if ($connection->connect_error) die($connection->connect_error);
global $connection;
$queryColumns = "SHOW COLUMNS FROM $thisTable";
$resultColumns = $connection->query($queryColumns);
if (!$resultColumns) die ("Database access failed: " . $connection->error);
global $resultColumns;
$queryRows = "SELECT * FROM $thisTable";
$resultRows = $connection->query($queryRows);
if (!$resultRows) die ("Database access failed: " . $connection->error);
global $resultRows;
$rows = $resultRows->num_rows;
global $rows;
global $connection;
drawTable();
?>
<!-- FORM FOR ADDING ROWS TO CURRENT TABLE -->
<div id="table">
<table id="formTable">
<form name="addRow" action="http://localhost:8888/IRC/IRCprocessinventory.php" method="POST">
<input type="hidden" name="control">
<td>
Add row?
</td>
<td></td>
<?php for ($pointer = 2 ; $pointer < $countColumnsGlobal ; ++$pointer) { ?>
<td>
<input type="text" name="<?php echo $columns[$pointer];?>">
</td>
<?php } ?>
<td>
<input type="submit" value="submit">
</td>
</form>
</table>
</div> <!-- end table -->
<?php
}
?>
</div> <!-- End #content -->
</body>
</html>
Page 2:
<?php
require_once 'IRCinventoryconfig.php';
ini_set('display_errors',1); error_reporting(E_ALL);
session_start();
if(isset($_SESSION['value'])) {
$thisTable = $_SESSION['value'];
$valuesArray = array();
if (isset($_POST)) {
$valuesArray = $_POST;
}
$columnsArray = array_keys($valuesArray);
array_splice($columnsArray, 0, 1);
$columnsString = implode(", ", $columnsArray);
$insertValues = array();
foreach($valuesArray as $values) {
$insertValues[] = $values;
}
$valuesString = implode("','", $insertValues);
$valuesString = "'".$valuesString."'";
$valuesString = substr($valuesString, 3);
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database, $db_port);
if ($connection->connect_error) die($connection->connect_error);
$queryInsert = "INSERT INTO $thisTable ($columnsString) VALUES ($valuesString)";
$result = $connection->query($queryInsert);
if (!$result) echo "INSERT failed: $query<br>" .
$connection->error . "<br><br>";
else echo "Successful entry";
$connection->close();
}
?>

PHP Calendar: Events seem to repeat themselves

I am busy coding a website that you can add an event to a calendar from a list of events stored in a database, and then the calendar will show the event for the amount of days the event is meant to go on.
So for example I have "Tennis Competition" that is 15 days long (specified in the database), then all I do is click on the day and choose the event, and it is meant to show the event for that day and the next 15 days.
If someone could maybe help me out with the next 15 days thing, as I've gotten stuck on how I will do that, if it will be when I add the event to the calendar just to add it 15 times, or add it once and let the calendar do the work.
Another problem I am having is that if I add an event for the 14th, and another for the 15th, both events will appear on the 15, and for the rest of the month.
Here is my code, I will be more specific on certain things if asked:
event.php:
<!DOCTYPE html>
<html>
<head>
<title>Nkoka Courses: Admin Panel - Add Calendar Event</title>
</head>
<body>
<h1>Show/Add Courses:</h1>
<?php
$mysql = mysql_connect('localhost', 'root', '');
if (!$mysql){
die("Database Connection Failed" . mysql_error());
}
$select_db = mysql_select_db('nkoka');
if (!$select_db){
die("Database Selection Failed" . mysql_error());
}
//add any new event
if ($_POST) {
//create database-safe strings
$m = $_POST['m'];
$d = $_POST['d'];
$y = $_POST['y'];
$safe_event = mysql_real_escape_string($_POST['event']);
$startdate = $y."-".$m."-".$d;
$insEvent_sql = "INSERT INTO calendar (event, startdate) VALUES('".$safe_event."', '".$startdate."')";
$insEvent_res = mysql_query($insEvent_sql) or die(mysql_error($mysql));
} else {
//create database-safe strings
$m = mysql_real_escape_string($_GET['m']);
$d = mysql_real_escape_string($_GET['d']);
$y = mysql_real_escape_string($_GET['y']);
}
//show events for this day
$getEvent_sql = "SELECT event, date_format(startdate, '%l:%i %p') as fmt_date FROM calendar WHERE month(startdate) = '".$m."' AND dayofmonth(startdate) = '".$d."' AND year(startdate) = '".$y."' ORDER BY startdate";
$getEvent_res = mysql_query($getEvent_sql) or die(mysql_error($mysql));
if (mysql_num_rows($getEvent_res) > 0) {
$event_txt = "<ul>";
while ($ev = #mysql_fetch_array($getEvent_res)) {
$event = stripslashes($ev['event']);
$fmt_date = $ev['fmt_date'];
$event_txt .= "<li>".$event."</li>";
}
$event_txt .= "</ul>";
mysql_free_result($getEvent_res);
} else {
$event_txt = "";
}
// close connection to MySQL
mysql_close();
if ($event_txt != "") {
echo "<p><strong>Courses:</strong></p>
$event_txt
<hr/>";
}
// show form for adding an event
require('../connect.php');
$sql = "SELECT * FROM `course`";
$result = mysql_query($sql) or die(mysql_error());
$count = mysql_num_rows($result);
?>
<form method="post" action="event.php">
<p><label>Select Course: </label>
<select name="event" id="event" style="position: relative;left: 95px; width: 175px;">
<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<option value="<?php echo $line['name'];?>"> <?php echo $line['name'];?> </option>
<?php }
?>
</select></p>
<input type="hidden" name="m" value="<?php echo $m; ?>"></input>
<input type="hidden" name="d" value="<?php echo $d; ?>"></input>
<input type="hidden" name="y" value="<?php echo $y; ?>"></input>
<button type="submit" name="submit" value="submit">Add Course</button>
</form>
</body>
</html>
<?php
// close connection to MySQL
mysql_close();
?>
calendar.php
<?php
define("ADAY", (60*60*24));
if ((!isset($_POST['month'])) || (!isset($_POST['year']))) {
$nowArray = getdate();
$month = $nowArray['mon'];
$year = $nowArray['year'];
} else {
$month = $_POST['month'];
$year = $_POST['year'];
}
$start = mktime (12, 0, 0, $month, 1, $year);
$firstDayArray = getdate($start);
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo "Calendar: ".$firstDayArray['month']." ".$firstDayArray['year']; ?></title>
<style type="text/css">
table {
border: 1px solid black;
border-collapse: collapse;
}
th {
border: 1px solid black;
padding: 6px;
font-weight: bold;
background: #ccc;
}
td {
border: 1px solid black;
padding: 6px;
vertical-align: top;
width: 100px;
}
</style>
<script type="text/javascript">
function eventWindow(url) {
event_popupWin = window.open(url, 'event', 'resizable=yes, scrollbars=yes, toolbar=no,width=400,height=150');
event_popupWin.opener = self;
}
</script>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<select name="month">
<?php
$months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
for ($x=1; $x <= count($months); $x++) {
echo"<option value=\"$x\"";
if ($x == $month) {
echo " selected";
}
echo ">".$months[$x-1]."</option>";
}
?>
</select>
<select name="year">
<?php
for ($x=2014; $x<=2024; $x++) {
echo "<option";
if ($x == $year) {
echo " selected";
}
echo ">$x</option>";
}
?>
</select>
<button type="submit" name="submit" value="submit">Go!</button>
</form>
<br/>
<?php
$days = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
echo "<table><tr>\n";
foreach ($days as $day) {
echo "<th>".$day."</th>\n";
}
for ($count=0; $count < (6*7); $count++) {
$dayArray = getdate($start);
if (($count % 7) == 0) {
if ($dayArray['mon'] != $month) {
break;
} else {
echo "</tr><tr>\n";
}
}
if ($count < $firstDayArray['wday'] || $dayArray['mon'] != $month) {
echo "<td> </td>\n";
} else {
require('../connect.php');
$chkEvent_sql = "SELECT event FROM calendar WHERE
month(startdate) = '".$month."' AND
dayofmonth(startdate) = '".$dayArray['mday']."'
AND year(startdate) = '".$year."' ORDER BY startdate";
$chkEvent_res = mysql_query($chkEvent_sql)
or die(mysql_error($mysql));
if (mysql_num_rows($chkEvent_res) > 0) {
while ($ev = mysql_fetch_array($chkEvent_res)) {
$event .= stripslashes($ev['event'])."<br/>";
}
} else {
$event = "";
}
echo "<td><a href=\"javascript:eventWindow('event.php?m=".$month.
"&d=".$dayArray['mday']."&y=$year');\">".$dayArray['mday']."</a>
<br/><br/>".$event."</td>\n";
$start += ADAY;
}
}
echo "</tr></table>";
//close connection to MySQL
mysql_close();
?>
</body>
</html>
Any help will be appreciated,
Thanks

Foreach loop from a Query using PHP

I have a query on my php which prints out a result of one row only, I need to print out all the rows for each and every user.
Here is the php:
<?php
// see if the form has been completed
include_once("php_includes/check_login_status.php");
//include_once("php_includes/db_conx.php");
// Initialize any variables that the page might echo
$username = "";
$weight = "";
$weighthist = "";
$id = "";
if(isset($_GET["u"])){
$username = preg_replace('#[^a-z0-9]#i', '', $_GET['u']);
}
$sql = "SELECT users.*, weighthistory.* FROM users JOIN weighthistory USING(id)";
$user_query = mysqli_query($db_conx, $sql);
// check if the user exists in the database
while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {
$id = $row ["id"];
$username = $row ["username"];
$weight = $row["weight"];
$weighthist = $row["weighthist"];
$point_hist = $row["point_hist"];
}
// this is to calculate points score
$calweight = $weight - $weighthist;
$points = $calweight * 10;
$res = mysqli_query($db_conx,'SELECT sum(point_hist) FROM points_history');
if (FALSE === $res) die("Select sum failed: ".mysqli_error);
$row = mysqli_fetch_row($res);
$sum = $row[0];
?>
Here is the HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Profile Update: <?php echo $u; ?></title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="js/main.js"></script>
<script src="js/javascript.js"></script>
<script src="js/ajax.js"></script>
<style type="text/css">
#updateform{
margin-top:24px;
}
#updateform > div {
margin-top: 12px;
}
#updateform > input {
width: 200px;
padding: 3px;
background: #F3F9DD;
}
</style>
</head>
<body>
<p> </p>
<?php include_once("template_pageTop.php"); ?>
<div id="pageMiddle">
<div id="usernamecss"> Username: <?php echo $username; ?></div>
<table width="100%" border="0">
<tr>
<td>Name</td>
<td>Weight</td>
<td>Rank</td>
<td>Points</td>
</tr>
<tr>
<td><?php echo $username ?></td>
<td><?php echo $weight?></td>
<td><?php echo $rank?></td>
<td><?php echo $sum?></td>
</tr>
</table>
<p> </p>
<strong></strong>
Go to Profile
</form>
</div>
<?php include_once("template_pageBottom.php"); ?>
</body>
</html>
I am new to this so how can I print all rows for all user ID, I get the idea I have to use a foreach loop.
This is how you could do it...
PHP file
<?php
// see if the form has been completed
include_once("php_includes/check_login_status.php");
//include_once("php_includes/db_conx.php");
// Initialize any variables that the page might echo
$username = "";
$weight = "";
$weighthist = "";
$id = "";
if(isset($_GET["u"])){
$username = preg_replace('#[^a-z0-9]#i', '', $_GET['u']);
}
$sql = "SELECT users.*, weighthistory.* FROM users JOIN weighthistory USING(id)";
$user_query = mysqli_query($db_conx, $sql);
// check if the user exists in the database
while ($row = mysqli_fetch_assoc($user_query)) {
$id = $row ["id"];
$username = $row ["username"];
$weight = $row["weight"];
$weighthist = $row["weighthist"];
$point_hist = $row["point_hist"];
// this is to calculate points score
$calweight = $weight - $weighthist;
$points = $calweight * 10;
$res = mysqli_query($db_conx,'SELECT sum(point_hist) FROM points_history');
if (FALSE === $res) die("Select sum failed: ".mysqli_error);
$row = mysqli_fetch_row($res);
$sum = $row[0];
?>
<div id="pageMiddle">
<div id="usernamecss"> Username: <?php echo $username; ?></div>
<table width="100%" border="0">
<tr>
<td>Name</td>
<td>Weight</td>
<td>Rank</td>
<td>Points</td>
</tr>
<tr>
<td><?php echo $username ?></td>
<td><?php echo $weight?></td>
<td><?php echo $rank?></td>
<td><?php echo $sum?></td>
</tr>
</table>
<p> </p>
<strong></strong>
Go to Profile
</form>
</div>
<?php
}
?>
HTML file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Profile Update: <?php echo $u; ?></title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="js/main.js"></script>
<script src="js/javascript.js"></script>
<script src="js/ajax.js"></script>
<style type="text/css">
#updateform{
margin-top:24px;
}
#updateform > div {
margin-top: 12px;
}
#updateform > input {
width: 200px;
padding: 3px;
background: #F3F9DD;
}
</style>
</head>
<body>
<p> </p>
<?php include_once("template_pageTop.php"); ?>
<?php include_once("template_pageBottom.php"); ?>
</body>
</html>
Edit:
If username is a column in your points_history table... then you can change this
$res = mysqli_query($db_conx,'SELECT sum(point_hist) FROM points_history');
if (FALSE === $res) die("Select sum failed: ".mysqli_error);
$row = mysqli_fetch_row($res);
$sum = $row[0];
to this
$query = "SELECT sum(point_hist) FROM points_history WHERE username = $username";
$res = mysqli_query($db_conx, $query);
$row = mysqli_fetch_row($res);
$sum = $row[0];

Unable to filter data from mysql

I tried to read data of my MySQL database, I created the fullcalendar and show up the event on calendar. However, it is unable to retrieve the data from my MySQL database.
The First php code :
<?php require_once('conn.php'); ?>
<?php $maxRows_RsCourse = 1000000;
$pageNum_RsCourse = 0;
if (isset($_GET['pageNum_RsCourse'])) {
$pageNum_RsCourse = $_GET['pageNum_RsCourse'];
}
$startRow_RsCourse = $pageNum_RsCourse * $maxRows_RsCourse;
mysql_select_db($database_conn, $conn);
$query_RsCourse = "SELECT * FROM tbl_course ORDER BY tcid ASC";
$query_limit_RsCourse = sprintf("%s LIMIT %d, %d", $query_RsCourse, $startRow_RsCourse, $maxRows_RsCourse);
$RsCourse = mysql_query($query_limit_RsCourse, $conn) or die(mysql_error());
$row_RsCourse = mysql_fetch_assoc($RsCourse);
if (isset($_GET['totalRows_RsCourse'])) {
$totalRows_RsCourse = $_GET['totalRows_RsCourse'];
} else {
$all_RsCourse = mysql_query($query_RsCourse);
$totalRows_RsCourse = mysql_num_rows($all_RsCourse);
}
$totalPages_RsCourse = ceil($totalRows_RsCourse/$maxRows_RsCourse)-1;
?>
<?php
$tbl_name="tbl_course"; // Table name
$totalcount = 0;
// Connect to server and select database.
mysql_connect("$hostname_conn", "$username_conn", "$password_conn")or die("cannot connect server ");
mysql_select_db("$database_conn")or die("unable to connect");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
// echo "<table><tr>";
// echo "<td>" . $rows['id'] . "</td><td>" . $rows['title'] . "</td><td>" . $rows['start'] . "</td><td>" . $rows['end'] . "</td><td>" . $rows['url'] . "</td><td>" . $rows['allDay'];
// echo "</td></tr></table>";
$event[$totalcount]['tcid']=$rows['tcid'];
$event[$totalcount]['courseid']=$rows['courseid'];
$event[$totalcount]['coursename']=$rows['coursename'];
$event[$totalcount]['startdate']=$rows['startdate'];
$event[$totalcount]['starttime']=$rows['starttime'];
$event[$totalcount]['enddate']=$rows['enddate'];
$event[$totalcount]['endtime']=$rows['endtime'];
$event[$totalcount]['allday']=$rows['allday'];
$totalcount++;
}
for ($i=0; $i < $totalcount; $i++)
{
$tmp1 = explode("-",$event[$i]['startdate']);
$tmp2 = explode(":",$event[$i]['starttime']);
// 0 = hour, 1 = minutes, 2 = seconds,
$x = 0;
foreach ($tmp1 as $date_values_1)
{
$event_start_date[$i][$x] = $date_values_1;
$x++;
}
$y = 0;
foreach ($tmp2 as $time_values_1)
{
$event_start_time[$i][$y] = $time_values_1;
$y++;
}
$tmp3 = explode("-",$event[$i]['enddate']);
$tmp4 = explode(":",$event[$i]['endtime']);
$a = 0;
foreach ($tmp3 as $date_values_2)
{
$event_end_date[$i][$a] = $date_values_2;
$a++;
}
$b = 0;
foreach ($tmp4 as $time_values_2)
{
$event_end_time[$i][$b] = $time_values_2;
$b++;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0046)http://localhost/calendar/demos/db_display.php -->
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<link href='css/fullcalendar.css' rel='stylesheet' />
<script src='js/jquery-1.9.1.min.js'></script>
<script src='js/jquery-ui-1.10.2.custom.min.js'></script>
<script src='js/fullcalendar.min.js'></script>
<SCRIPT>
$(document).ready(function() {
var start_year = new Array(<?php $totalcount?>);
var start_month = new Array(<?php $totalcount?>);
var start_day = new Array(<?php $totalcount?>);
var end_year =new Array(<?php $totalcount?>);
var end_month =new Array(<?php $totalcount?>);
var end_day =new Array(<?php $totalcount?>);
var start_hour =new Array(<?php $totalcount?>);
var start_mins =new Array(<?php $totalcount?>);
var end_hour =new Array(<?php $totalcount?>);
var end_mins =new Array(<?php $totalcount?>);
<?php
$k = 0;
for ($k=0; $k < $totalcount; $k++) {?>
start_year[<?php echo $k?>] =<?php echo $event_start_date[$k][0] ?>;
start_month[<?php echo $k?>] =<?php echo $event_start_date[$k][1] ?>;
start_day[<?php echo $k?>] =<?php echo $event_start_date[$k][2]?>;
end_year[<?php echo $k?>] =<?php echo $event_end_date[$k][0]?>;
end_month[<?php echo $k?>] =<?php echo $event_end_date[$k][1]?>;
end_day[<?php echo $k?>] =<?php echo $event_end_date[$k][2]?>;
start_hour[<?php echo $k?>] =<?php echo $event_start_time[$k][0] ?>;
start_mins[<?php echo $k?>] =<?php echo $event_start_time[$k][1] ?>;
end_hour[<?php echo $k?>] =<?php echo $event_end_time[$k][0]?>;
end_mins[<?php echo $k?>] =<?php echo $event_end_time[$k][1]?>;
<?php } ?>
var calendar = $('#calendar').fullCalendar({
editable: false,
events: [
<?php $j = 0;
for ($j=0; $j < $totalcount; $j++)
{
?>
<?php
if ($event[$j]['allday'] == 0){?>
{ title: '<?php echo $event[$j]['courseid'];?> <?php echo $event[$j]['coursename'];?>',
start: new Date(start_year[<?php echo $j?>],start_month[<?php echo $j?>]-1,start_day[<?php echo $j?>],start_hour[<?php echo $j?>],start_mins[<?php echo $j?>]),
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]) , url: 'mg_course.php?courseid=<?php echo $event[$j]['courseid']; ?>'
/*
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]) , url: 'mg_course.php?courseid=<?php echo $_GET['courseid']; ?>'
*/
},
<?php } ?>
<?php if ($event[$j]['allday'] == 1) {?>
{ title: '<?php echo $event[$j]['courseid'];?> <?php echo $event[$j]['coursename'];?>',
start: new Date(start_year[<?php echo $j?>],start_month[<?php echo $j?>]-1,start_day[<?php echo $j?>],start_hour[<?php echo $j?>],start_mins[<?php echo $j?>]),
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]), url: 'mg_course.php?courseid=<?php echo $event[$j]['courseid']; ?>',
/*
end: new Date(end_year[<?php echo $j?>],end_month[<?php echo $j?>]-1,end_day[<?php echo $j?>],end_hour[<?php echo $j?>],end_mins[<?php echo $j?>]), url: 'mg_course.php?courseid=<?php echo $_GET['courseid']; ?>',
*/
allDay: 'false'
},
<?php } ?>
<?php }?>
{}
]
});
});
</SCRIPT>
<STYLE>BODY {
TEXT-ALIGN: center; MARGIN-TOP: 40px; FONT-FAMILY: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; FONT-SIZE: 14px
}
#calendar {
MARGIN: 0px auto; WIDTH: 900px
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.6001.19412"></HEAD>
<BODY>
<DIV id=calendar></DIV></BODY></HTML>
Here is display event details php:
<?php require_once('conn.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
?>
<?php
$totalRows_RsEnrol = 0;
if ( isset($_POST['courseid']) ) {
$_GET['courseid'] = $_POST['courseid'];
$_GET['courseid'] = $_GET['courseid'] * 1;
if (is_integer($_GET['courseid']) ) {
$maxRows_RsEnrol = 10000;
$pageNum_RsEnrol = 0;
if (isset($_GET['pageNum_RsEnrol'])) {
$pageNum_RsEnrol = $_GET['pageNum_RsEnrol'];
}
$startRow_RsEnrol = $pageNum_RsEnrol * $maxRows_RsEnrol;
mysql_select_db($database_conn, $conn);
$query_RsEnrol = "SELECT * FROM 'tbl_enroll' WHERE 'tbl_enroll'.'courseid' = '".$_GET['courseid']."'";
//$query_RsEnrol = sprintf("SELECT erid, courseid, staffid FROM tbl_enroll WHERE courseid = %s ORDER BY staffid ASC", $_GET['courseid']);
$query_limit_RsEnrol = sprintf("%s LIMIT %d, %d", $query_RsEnrol, $startRow_RsEnrol, $maxRows_RsEnrol);
$RsEnrol = mysql_query($query_limit_RsEnrol, $conn) or die(mysql_error());
$row_RsEnrol = mysql_fetch_assoc($RsEnrol);
if (isset($_GET['totalRows_RsEnrol'])) {
$totalRows_RsEnrol = $_GET['totalRows_RsEnrol'];
} else {
$all_RsEnrol = mysql_query($query_RsEnrol);
$totalRows_RsEnrol = mysql_num_rows($all_RsEnrol);
}
$totalPages_RsEnrol = ceil($totalRows_RsEnrol/$maxRows_RsEnrol)-1;
} else { $totalRows_RsEnrol = 0;}
}
/******************************************************************************************************/
elseif (isset($_GET['courseid']) && !empty($_GET['courseid']) ) {
$_GET['courseid'] = $_GET['courseid']*1;
if (is_integer($_GET['courseid'])){
$maxRows_RsEnrol = 1000000;
$pageNum_RsEnrol = 0;
if (isset($_GET['pageNum_RsEnrol'])) {
$pageNum_RsEnrol = $_GET['pageNum_RsEnrol'];
}
$startRow_RsEnrol = $pageNum_RsEnrol * $maxRows_RsEnrol;
mysql_select_db($database_conn, $conn);
$query_RsEnrol = sprintf("SELECT * FROM tbl_enroll WHERE courseid IN ( SELECT courseid FROM tbl_course WHERE courseid = %s) ORDER BY erid ASC", $_GET['courseid']);
//$query_RsEnrol = sprintf("SELECT erid, courseid, staffid FROM tbl_enroll WHERE courseid=%s ORDER BY staffid ASC", $_GET['courseid']);
$query_limit_RsEnrol = sprintf("%s LIMIT %d, %d", $query_RsEnrol, $startRow_RsEnrol, $maxRows_RsEnrol);
$RsEnrol = mysql_query($query_limit_RsEnrol, $conn) or die(mysql_error());
$row_RsEnrol = mysql_fetch_assoc($RsEnrol);
if (isset($_GET['totalRows_RsEnrol'])) {
$totalRows_RsEnrol = $_GET['totalRows_RsEnrol'];
} else {
$all_RsEnrol = mysql_query($query_RsEnrol);
$totalRows_RsEnrol = mysql_num_rows($all_RsEnrol);
}
$totalPages_RsEnrol = ceil($totalRows_RsEnrol/$maxRows_RsEnrol)-1;
} else {$totalRows_RsEnrol=0;}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link href="../../css/style_new.css" rel="stylesheet" type="text/css" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<br />
<table width="322" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="171"><img src="../../Images/logo.gif" width="144" height="34"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center" ><h2>Training Program</h2></td>
</tr>
</table>
<div class="containers" align=">
<div class="header">
<p align="center" class="style2">Enrolment</p>
<h5 class="../css/new_style.css" align="left">
<table align="center" width="116%" border="0" cellpadding="0" cellspacing="2" >
<tr align="center" bgcolor="#CCCCCC" >
<td width="16%">Enrolment ID</td>
<td width="50%">Course ID</td>
<td width="14%">Staff ID</td>
<td width="10%"> </td>
<td width="10%"> </td>
</tr>
<tr align="center" bgcolor="#dfdfdf" >
<td><?php echo $row_RsEnrol['erid']; ?></td>
<td align="left"> <?php echo $row_RsEnrol['courseid']; ?></td>
<td><?php echo $row_RsEnrol['staffid']; ?></td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
It is unable to filter data on Calendar.
I am really appreciated for your help.

Categories