Updating MySQL record not working

I’m unable to make the dataprocessor work in Touch, although I use it with no problems in the desktop version of DHX.

I believe that I have everything coded correctly in the html file. I took one of your examples and just changed the field names to the ones in my database, with everything else remaining the same. The data appears properly in this example which uses a list and form with a SAVE button on the form.

Pressing the save button, does save the changes for the currently loaded data, but the data is not saved back to the MySQL record by the dataprocessor.

This leads me to wonder if there is something I have wrong or incomplete in my data.php file. Superficially it looks like essentially the same thing as the one in the example. This is my php file

<?php class DB { public function connect($db='', $db_host='', $db_port='', $db_user='', $db_pass='', $db_name='' ) { $db = ($db)? $db : $_SESSION["db"]; $db_host = ($db_host)? $db_host : $_SESSION["db_host"]; $db_port = ($db_port)? $db_port : $_SESSION["db_port"]; $db_user = ($db_user)? $db_user : $_SESSION["db_user"]; $db_pass = ($db_pass)? $db_pass : $_SESSION["db_pass"]; $db_name = ($db_name)? $db_name : $_SESSION["db_name"]; @$link = mysql_connect($db_host.':'.$db_port, $db_user, $db_pass); if ($link) $db_select = mysql_select_db($db_name, $link); if (!$db_select) $link = false; return $link; } } require_once("config.php"); $res = DB::connect("MySQL", "jspersonal.db.2523046.hostedresource.com", "3306", "jspersonal", "tk7tntJSP1!@#", "jspersonal" ); mysql_query("SET NAMES UTF8"); $data = new JSONDataConnector($res, "MySQL"); $data->dynamic_loading(10); $data->render_table("boxes", ""," box_num_boxes, need_boxes, item_boxes "); ?>

This connects to the MySQL data properly and displays it, but I wonder if I have to change something to allow it to be updated by the dataprocessor.

THE OTHER POSSIBILITY which you don’t use in your example, is the use of SEND(), which is mentioned in the reference documentation. However, I have no idea how to invoke this mehtod, where, or if any parameters are required–none of that is shown in the method reference, and I can’t find an example of the usage.

However, it appears that it should not be needed. Have I given you enough information to help me? I’ve worked on this for a long time and can’t figure it out.

Thanks,
JS

Your code has a major flaw - you have not specified record ID ( second field for render_table ). Without unique ID record can’t be updated in the database ( client side doesn’t know which record to update )

dhtmlxTouch uses the same server side code as common dhtmlx components, so code that works for normal components must work for touch as well ( above code, without id specified, will not work for common components )

Thank you very much for your kind reply–it makes sense.

I’m still confused on what parameters are automatically handled by the dataprocessor, and what ones need manual specification. In one of the on-line examples, the php file contains this:

$data = new JSONDataConnector($db,$dbtype);
$data->render_table(“users”, “id”, “name,age,group_name,city,phone,sex,driver_license”);

I don’t understand if the “id” should be coded exactly like shown, or if the example implies that I have manually located a record id and I must specify a reference to it.

I would very much appreciate your insight on this.

Thanks,
John

You need to provide

  • name of table
  • name of id field in the table
  • name of fields that you will need on client side

The second parameter - “id” - name of id field in the related table. You have some field in the table that is used as identification right ? For best functionality it must be an autoincrement integer field.