joeros Posted June 14, 2010 Share Posted June 14, 2010 i Have some code (free source) that i have adapted from Micheal Frank of this website http://www.eyesis.ca (eyedatagrid) I have changed what i need to suit my requirements but i am having problems updating and adding to a database. i have put code in the routine to echo the fact that that is where the code executes but apparently it does not the code is as follows THIS IS THE ORIGINAL $x->showCreateButton("alert('Code for creating a new person')", EyeDataGrid::TYPE_ONCLICK, 'Add New Person'); when the button is clicked the alert box pops up with the message 'Code for creating a new person'. i changed the code to what i THINK is correct THIS IS MODIFIED $x->showCreateButton("insert('Tom,White,1959-20-10,f,25,'people')", EyeDataGrid::TYPE_ONCLICK, "Add New Item"); I do not get an error with this syntax so i am thinking it is correct i think that this is the code that is supposed to be called /** * Insert one new row * * @param array $values 3D array of fields and values to be inserted * @param string $table Table to insert * @return boolean Result */ public function insert(array $values, $table) { print "here"; alert('Code for creating a new person'); if (count($values) < 0) return false; foreach($values as $field => $val) $values[$field] = $this->escapeString($val); if ($this->query("INSERT INTO `" . $table . "`(`" . implode(array_keys($values), "`, `") . "`) VALUES ('" . implode($values, "', '") . "')")) return true; else return false; } but when i click the web-page button nothing happens not even the print or the alert. could anyone shed any light on this problem? It really is a neat bit of code and i can learn a lot from using this Many thanks to any replies Quote Link to comment https://forums.phpfreaks.com/topic/204695-help-with-interpreting-code/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.