Jump to content

joeros

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by joeros

  1. I agree and i have only been coding php for just over a week so i am very inexperienced, however i thought there was enough info there for a reasonable php programmer to steer me in the correct direction. Anyway, i have almost been able to work it out myself. All i needed to do was instead of duplicating code and changing parameters i just need to change this line $x->addRowSelect("alert('You have selected id # %url%')"); so that it becomes $x->addRowSelect("window.open('%url%')"); this opens the jpg in a new window but it is a full size window. i just want the thumbnail to open in a small window as a jpg. Any pointers?
  2. Hi, i removed the parentheses and fixed the spelling mistake (addUrl). still no work. as this is not originally my code the way i read is this, Addurlselect takes the url address to the openpopup function which 'should' create a jpg popup image but obviously does not. as i said i have read the original code and this is what it seems to do so i made what i thought was the appropriate changes
  3. i have the following code that i am trying to adapt. $x->addRowSelect("alert('You have selected id # %url%')"); /** * Adds ability to select a entire row * * @param string $onclick The JS function to call when a row is clicked */ public function addRowSelect($onclick) { $this->row_select = $onclick; } // Handle row selects if ($this->row_select) echo ' tbl-row-highlight" onclick="' . $this->parseVariables($row, $this->row_select); echo '">'; What happens is that when a row is clicked a pop window appears and gives the details of the specified field. What i am trying to do is have a window popup with a jpg picture instead. what i have done is this $x->addUrlSelect("href=(javascript:openpopup('tnail.jpg'))"); <script> function openpopup(popurl){ winpops=window.open(popurl,"","width=400,height=338,") } </script> public function adUrlSelect($openpopup) { $this->url_select = $openpopup; } Now as far as i can see everything is syntactically correct but is not working. Can anyone advise as to where i am going wrong please? as usual thanks for any replies
  4. @DavidAm Thanks SO much for that, surprising how easy it is when you know how
  5. I need to be able to pass fieldnames and values in an array the decoding is done like this public function insert(array $values, $table) { if (count($values) < 0) return false; foreach($values as $field => $val) $values[$field] = $this->escapeString($val); i have tried passing the arrays like this $values = array ("'Joe', 'Timbs', '1985-12-12', 'f', '50'"); insert ($values,"people"); but i am not sure how to pass the fieldnames. Can anyone help Thanks to any replies
  6. 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
  7. Bugger me, as soon as i post i sit back and look at the code and the answer comes to me. it's just a matter of dropping the quotes off the begining and the end of the string and then it returns the correct result. oh well it is good to find the solution yourself
  8. Hi, I am Very new to php but i have experience in other coding. I am trying to place a variable into some code that queries a database. This code works $x->setQuery("*", "people","gender","gender='m'"); This code also works $qry = "gender='f'"; $x->setQuery("*", "people","gender",$qry); And this code does not work nor does it throw any error it just does not return any records $ qry = chr(34); $ qry .= "gender="; $ qry .= chr(39); $ qry .= $PCode; $ qry .= chr(39); $ qry .= chr(34); Can anyone explain how to achieve what I am trying to do and/or explain why the above does not work? This is the actual query being referenced /** * Set the SELECT query * * @param string $fields Feilds to fetch from table. * for all columns * @param string $table Table to select from * @param string $primay Optional primary key column * @param string $where Optional where condition */ public function setQuery($fields, $table, $primary = '', $where = '') { $this->primary = $primary; $this->select_fields = $fields; $this->select_table = $table; $this->select_where = $where; }
×
×
  • 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.