I am new to php but i have experience in other disciplines of programming
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
Code: Select all
$x->showCreateButton("alert('Code for creating a new person')", EyeDataGrid::TYPE_ONCLICK, 'Add New Person');
THIS IS MODIFIED
Code: Select all
$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
Code: Select all
/**
* 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;
}
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