01-04-2018, 02:09 AM
Okay first of all thank you guys for this project. It's easy to use and very exandable!
I use it for my own CMS and event website etc. But I'm very stuck on the latter with updating agenda items.... I use the insert function to make events. U use a db->query(DELETE FROM) to remove it. But updating just doesn't seem to work. I tried the update function provided by userspice and typing out a db->query(UPDATE agenda SET desc = ? WHERE id = $id) But nothing seems to work. Which is weird since it does give the succes message.
I really don't know what to do and am a beginner in PHP and sql. Can someone please be so kind to point me in the right direction?
Here is the PHP file:
<?php
require_once 'users/init.php';
require_once $abs_us_root . $us_url_root . 'users/includes/header.php';
require_once $abs_us_root . $us_url_root . 'users/includes/navigation.php';
if (!securePage($_SERVER['PHP_SELF'])) {
die();
}
$id = $_POST['agendaid'];
$title = $_POST['title'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$time = $_POST['time'];
$desc = $_POST['desc'];
$fblink = $_POST['fblink'];
$content1 = $db->query("SELECT * FROM agenda WHERE id = ?", [$id]);
$results = $content1->results();
$z1 = $query->results(true); //dump($z[0]);
$x = $z1[$eventid]["eventid"];
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if ($z1[0]) {
$field = array('desc' => $desc); //column_name=>entry
$db->update('agenda', $id, $fields);
$db->query("UPDATE agenda SET desc = ? WHERE id = ?", [$desc, $id]);
echo '<div style="text-align:center;">Evenement is succesvol gewijzigd.<br /><br />Je wordt automatisch binnen 5 seconden teruggestuurd naar de vorige pagina.</div>';
header("refresh:5;url=testpermissions.php");
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
} else {
echo '<div style="text-align:center;">Er is iets fout gegaan...</div';
header("refresh:5;url=testpermissions.php");
}
if ($db->query()) {
}// End of if profile is ok
else {
echo 'Something went wrong... Contact the website administrator for help';
}
require_once $abs_us_root . $us_url_root . 'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls
I use it for my own CMS and event website etc. But I'm very stuck on the latter with updating agenda items.... I use the insert function to make events. U use a db->query(DELETE FROM) to remove it. But updating just doesn't seem to work. I tried the update function provided by userspice and typing out a db->query(UPDATE agenda SET desc = ? WHERE id = $id) But nothing seems to work. Which is weird since it does give the succes message.
I really don't know what to do and am a beginner in PHP and sql. Can someone please be so kind to point me in the right direction?
Here is the PHP file:
<?php
require_once 'users/init.php';
require_once $abs_us_root . $us_url_root . 'users/includes/header.php';
require_once $abs_us_root . $us_url_root . 'users/includes/navigation.php';
if (!securePage($_SERVER['PHP_SELF'])) {
die();
}
$id = $_POST['agendaid'];
$title = $_POST['title'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$time = $_POST['time'];
$desc = $_POST['desc'];
$fblink = $_POST['fblink'];
$content1 = $db->query("SELECT * FROM agenda WHERE id = ?", [$id]);
$results = $content1->results();
$z1 = $query->results(true); //dump($z[0]);
$x = $z1[$eventid]["eventid"];
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if ($z1[0]) {
$field = array('desc' => $desc); //column_name=>entry
$db->update('agenda', $id, $fields);
$db->query("UPDATE agenda SET desc = ? WHERE id = ?", [$desc, $id]);
echo '<div style="text-align:center;">Evenement is succesvol gewijzigd.<br /><br />Je wordt automatisch binnen 5 seconden teruggestuurd naar de vorige pagina.</div>';
header("refresh:5;url=testpermissions.php");
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
} else {
echo '<div style="text-align:center;">Er is iets fout gegaan...</div';
header("refresh:5;url=testpermissions.php");
}
if ($db->query()) {
}// End of if profile is ok
else {
echo 'Something went wrong... Contact the website administrator for help';
}
require_once $abs_us_root . $us_url_root . 'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls