Can add but cannot delete records in a mySQL database

Hello,
I created a very simple web application where I am using Grid and Form with a php connector and a dataProcessor (using the same connector).
I am able to add new records in my database but when I try deleting one it just doesn’t happen, it’s crossed-out and removed from my Grid but not from the database table.
As you can see below I don’t really use my whole Form yet, just the buttons.
Any thoughts?

My html file:

[code]

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<link rel="STYLESHEET" type ="text/css" href="dhtmlxSuite/dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="STYLESHEET" type ="text/css" href="dhtmlxSuite/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<link rel="STYLESHEET" type = "text/css" href="dhtmlxSuite/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css">


<script src="dhtmlxSuite/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script src="dhtmlxSuite/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script src="dhtmlxSuite/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script src="dhtmlxSuite/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script>
<script src="dhtmlxSuite/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
<script src="dhtmlxSuite/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor_debug.js"></script>
<script src="dhtmlxSuite/dhtmlxConnector_php/codebase/connector.js"></script>
<script src="dhtmlxSuite/dhtmlxForm/codebase/dhtmlxcommon.js"></script>
<script src="dhtmlxSuite/dhtmlxForm/codebase/dhtmlxform.js"></script>
mygrid = new dhtmlXGridObject("gridbox"); mygrid.setImagePath("dhtmlxSuite/dhtmlxGrid/codebase/imgs/"); mygrid.setHeader("First Name,Last Name"); mygrid.setInitWidths("200,*"); mygrid.setColTypes("ed,ed"); //editable,editable mygrid.setSkin("dhx_skyblue"); mygrid.init(); mygrid.enableSmartRendering(true);
    mygrid.loadXML("connector.php");
    
    var mydp = new dataProcessor("connector.php");
    mydp.init(mygrid);
    
    
    
    
    var myForm, formData;
    initForm();
	function initForm() {
		formData = [
		    {type:"settings",position:"label-top"},
	   	    {type: "fieldset",name:"form", label: "Εγγραφή", list:[
				{type: "input", name: 'firstName', label: 'First name:'},
				{type:"input", name:"lastName", label:"Last Name:", position:"label-top"},
				{type:"button", name:"submit", value:"Υποβολή"},
                                    {type:"button", name:"delete", value:"Διαγραφή"}
	   	    ]}
	        ];
		myForm = new dhtmlXForm("form_container", formData);
                    //myForm.bind(mygrid);

		myForm.attachEvent("onButtonClick", function(id){ 
                        if(id=="submit"){
                            var new_id = mygrid.uid();
                            mygrid.addRow(new_id, "Tralala, Tralalo",0);
                        }
                        else if(id=="delete"){
                            var selectedItem = mygrid.getSelectedRowId();
                            mygrid.deleteRow(selectedItem);
                        }
                            
                    });
		         
		      
		
		
	}
    
    
</script>
[/code]

My connector:

[code]<?php

require_once(“dhtmlxSuite/dhtmlxConnector_php/codebase/grid_connector.php”);
$conn = mysql_connect(““,”“,”***”);
mysql_select_db(“****”);

$grid = new GridConnector($conn,“MySQL”);
$grid->dynamic_loading(1000);
$grid->enable_log(“log.txt”, true);

//
if($grid->is_select_mode())
$grid->render_sql(“SELECT firstname, lastname FROM employee”,“employee_id”, “firstname,lastname”);
else
$grid->render_table(“employee”, “employee_id”, “firstname,lastname”);
?>[/code]

My log:

====================================
Log started, 21/08/2012 03:08:15

SELECT firstname, lastname FROM employee LIMIT 0,1000

SELECT COUNT(*) as DHX_COUNT FROM employee

Done in 0.17958378791809s

====================================
Log started, 21/08/2012 03:08:19

DataProcessor object initialized
1345557435x6_gr_id => 1345557435x6
1345557435x6_c0 => Tralala
1345557435x6_c1 => Tralalo
1345557435x6_!nativeeditor_status => deleted
ids => 1345557435x6

Row data [1345557435x6]
employee_id => 1345557435x6
firstname => Tralala
lastname => Tralalo
!nativeeditor_status => deleted

DELETE FROM employee WHERE employee_id=‘1345557435x6’

Edit operation finished
0 => action:deleted; sid:1345557435x6; tid:1345557435x6;

Done in 0.11796998977661s

I just found out that if I add a record and delete it without refreshing it does not appear on the next refresh.

The log:

====================================
Log started, 22/08/2012 09:08:54

DataProcessor object initialized
1345619154450_gr_id => 1345619154450
1345619154450_c0 => Tralala
1345619154450_c1 => Tralalo
1345619154450_!nativeeditor_status => inserted
ids => 1345619154450

Row data [1345619154450]
employee_id => 1345619154450
firstname => Tralala
lastname => Tralalo
!nativeeditor_status => inserted

INSERT INTO employee(firstname,lastname) VALUES (‘Tralala’,‘Tralalo’)

Edit operation finished
0 => action:inserted; sid:1345619154450; tid:30;

Done in 0.15262198448181s

====================================
Log started, 22/08/2012 09:08:57

DataProcessor object initialized
30_gr_id => 30
30_c0 => Tralala
30_c1 => Tralalo
30_!nativeeditor_status => deleted
ids => 30

Row data [30]
employee_id => 30
firstname => Tralala
lastname => Tralalo
!nativeeditor_status => deleted

DELETE FROM employee WHERE employee_id=‘30’

Edit operation finished
0 => action:deleted; sid:30; tid:30;

Done in 0.13559889793396s

Is it my primary key? I read something on the forum about the connector having problems with primary keys containing the underscore ("_") character.

Problem is in php code

$grid->render_sql("SELECT firstname, lastname FROM employee","employee_id", "firstname,lastname");

it must be

$grid->render_sql("SELECT employee_id, firstname, lastname FROM employee","employee_id", "firstname,lastname");

Original SQL doesn’t select id field from database, so connector generates fake ids instead of real one, which fails during data saving operations.

Thank you so very much Stanislav, it was obvious and I missed it, I thank you again for your time.