How to insert/update/delete event directly to the database

Hi, need your help with the database manipulation of my calendar events.

below is my scheduler php code:

<?php if(isset($_GET['id'])) { require('config.php'); $id=$_GET['id']; $query='select * from tblaccounts where id='.$id; $result=mysql_query($query) or die(mysql_error()); $row=mysql_fetch_array($result); $color=$row['color']; } ?>

<!doctype html>

html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; }
Display: Andrea Arjun Francois Jean JV Sadaf Shanoop Sajeesh Yousaf
 
 

And below is my mysql connection php code:

<?php if(isset($_GET['id'])) { $id=$_GET['id']; require('config.php'); require('scheduler/scheduler_connector.php'); $query='SELECT s.id, s.startdate, s.enddate, a.firstname as type, a.color, s.event, s.activity, s.clientname, s.contactnumber, s.location, s.description, s.reference, s.owner, CASE WHEN s.owner<>'.$id.' THEN "True" ELSE "" END AS readonly FROM tbluser u, tblschedule s, tblaccounts a WHERE s.owner=a.id AND a.dept_id=u.dept_id'; $conn=new SchedulerConnector($conn); $conn->render_sql($query,"id","startdate,enddate,event,color,clientname,activity,contactnumber,description,location,reference,type,owner,readonly","","type"); } ?>

What’s missing in my code so I can directly save/update/delete in the database?

Hello,
in your sql you do selection from multiple tables, connector cannot generate appropriate sql to perform instert/update/delete operations.
So you have to define such sqls manually, using $connector->sql->attach method.
First argument is a type of operation “insert”, “update” or “delete”. Second parameter - the sql query. Request values can be used as {valueName}

[code]$conn=new SchedulerConnector($conn);

$conn->sql->attach(“delete”,“DELETE FROM table_name WHERE id = ‘{id}’”);
$conn->sql->attach(“update”,“UPDATE table_name SET startdate = ‘{startdate}’, … WHERE id = ‘{id}’”);
$conn->sql->attach(“insert”,“INSERT INTO …”);

$conn->render_sql($query,“id”,“startdate,enddate,event,color,clientname,activity,contactnumber,description,location,reference,type,owner,readonly”,"",“type”);[/code]