From: Jason B. <jas...@mi...> - 2006-10-10 12:30:09
|
> do you by chance also updated MySQL? It looks like read as a column name > is not allowed. A good practice is to add a column-prefix to every > column, to make sure you dont clash with reserved words of the DB. ...no, it is still the same version of MySQL. CentOS 4.4 server, running mysql-server-4.1.20-1.RHEL4.1. "read" is not the name of a column or data field, it is the name of the submit button. This was taken directly from your eTemplate tutorial. > Just a thought ... Here is the function I created, again pretty much from the tutorial. So from what you're saying, should I rename that from "read" to maybe "readbutton" or something like that? Does this mean the tutorial itself would no longer work with eGW 1.2? function edit($content='',$msg = '') { if (is_array($content)) // we are called as callback for the dialog / form { if ($content['id'] > 0) // if we have an id --> read the entry { $this->read($content); } $this->data_merge($content); // merge content with our internal data-array ($this->data) if (isset($content['save'])) // save the entry ($this->data) { $msg .= !$this->save() ? lang('Entry saved') : lang('Error: writeing !!!'); } elseif (isset($content['read'])) { unset($content['id']); // not set by user, so dont use for seach $found = $this->search($content,False,'id,ip,customer,market,tower','','%'); // searches by using the no-empty fields if (!$found) // search returned empty { $msg .= lang('Nothing matched search criteria !!!'); } elseif (count($found) == 1) // only one match --> show it in the editor { $this->init($found[0]); } else // multiple matches --> use the show function/template { $this->show($found); return; } } elseif (isset($content['entry']['edit'])) // the callback from for the show function/template { // the id is set via the button name of '$row_cont[id]' list($id) = each($content['entry']['edit']); // note its not only ['edit'] !!! if ($id > 0) { $this->read(array('id' => $id)); } } elseif (isset($content['cancel'])) { $this->init(); } elseif (isset($content['delete'])) { $this->delete(); $this->init(); } $no_button = array( // no delete button if id == 0 --> entry not saved 'delete' => !$this->data[$this->db_key_cols[$this->autoinc_id]] ); } // now we filling the content array for the next call to etemplate.exec $content = $this->data + array( // the content to be merged in the template 'msg' => $msg ); $sel_options = array( // the options for our type selectbox 'netmask' => $this->netmasks, 'market' => $this->markets, 'tower' => $this->towers, 'bandwidth' => $this->bandwidths, 'radiomode' => $this->radiomodes, 'reassign' => $this->reassign, 'actualtower' => $this->actualtowers ); $no_button = array( // button not to show ); $preserv = array( // this data is preserved over the exec-call (like a hidden input-field in form) 'id' => $this->data['id'] ); $this->tmpl->exec( 'ipdb.ipdb.edit', // setting this function as callback for the dialog $content,$sel_options,$no_button,$preserv ); } > Jason Byrns schrieb: >> Good afternoon, all... ;) >> >> I was just testing out an upgrade for our main eGroupWare system, going >> to the latest 1.2 version. >> >> Everything seems fine except for my custom eTemplate application. It is >> essentially similar to the tutorial for eTemplate, just a fairly simple >> database app. (Tracking IP addresses for customers, instead of albums >> and CDs. The main difference is I have a few more fields, that's about it.) >> >> The line in my code that does the searching, still mainly from the tutorial: >> >> $found = >> $this->search($content,False,'id,ip,customer,market,tower','','%'); >> // searches by using the no-empty fields >> >> I looked up the function this is calling, so I could add the '%' to the >> searches. I wanted to find anything containing the search string, not >> just exact matches. >> >> That worked on 1.0, but apparently not on 1.2. Can anyone help me >> understand why, and learn how to fix it...? ;) >> >> >> Database error: Invalid SQL: SELECT * FROM phpgw_ipdb WHERE customer >> LIKE '%test%' AND read LIKE '%Search%' ORDER BY id,ip,customer,market,tower >> mysql Error: 1064 (You have an error in your SQL syntax; check the >> manual that corresponds to your MySQL server version for the right >> syntax to use near 'read LIKE '%Search%' ORDER BY >> id,ip,customer,market,tower' at line 1) >> >> File: /var/www/html/egroupware/etemplate/inc/class.so_sql.inc.php >> Line: 611 >> Function: egw_db::select / ipdb::search / ipdb::edit / execmethod() / >> etemplate::process_exec / execmethod() >> >> Session halted. |