-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot display events from mysql #759
Comments
Hello, I used the same tutorial and I am able to fetch the events from the database. You can take help from the following code: `<?php
?>` |
Your issue needs more code which you have written yourself and also the issue you are experiencing meaning , what error code do you got ? Do you got any error in the developer console? (F12) when you have the page open? Either 1 the table is empty which you are calling or the connection is not properly made or you got a error when you changed the tutorial code. Either or all I cannot see without seeing the code. or adding more screenshots.
Try below script and fill in your own variables to see if the connection can be made properly to the DB; if you keep getting connection failed its due to some variables set which are incorrect. If you do not know the servername ask the webhost, if its on your own pc localhost should do the trick.
|
Hi. I just followed the exact files from this tutorial
https://phpzag.com/demo//create-event-calendar-with-jquery-php-and-mysql/
The only thing I changed is Im using my own sql table. So I changed the query in the codes too. But I could not display or even fetch my events from the database. Can someone help me?
`<?php
session_start();
//require_once 'TEST_conn.php';
include_once("TEST_conn.php");
//$mysqli = new mysqli("localhost","intern", "intern*3922539#", "Office HqRM");
//$user = "SELECT Email, Username FROM User WHERE Username like '".$_SESSION['Username']."'";
//$strUser = mysql_query($user, $link_ID);
//$ObjUser = mysql_fetch_object($strUser);
//$SelLoc = $_POST['loc'];
$sqlEvents = "SELECT LocationNo, IP, StartDate, EndDate FROM Schedule";
$resultset = mysql_query($conn, $sqlEvents) ;
$calendar = array();
while( $rows = mysqli_fetch_assoc($resultset) ) {
// convert date to milliseconds
$start = strtotime($rows['StartDate']) * 1000;
$end = strtotime($rows['EndDate']) * 1000;
$calendar[] = array(
'LocationNo' =>$rows['LocationNo'],
'IP' => $rows['IP'],
'url' => "#",
"class" => 'event-important',
'start' => "$start",
'end' => "$end"
);
}
$calendarData = array(
"success" => 1,
"result"=>$calendar);
echo json_encode($calendarData);
exit;
`
The text was updated successfully, but these errors were encountered: