Jump to content

help with interpreting code


joeros

Recommended Posts

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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.