![]() |
|
|||||||
| embarcadero.public.delphiphp.database This group is for all discussion about databases and using them with Delphi for PHP. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello,
I'm doing a small application to view, insert, edit and delete data from a table. I'm connecting to Mysql and using Query. I can view and browse the records, but can't do any insert or update. Whenever i try to post, i get this error : Application raised an exception class ADODB_Exception with message '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 'LIMIT 1' at line 1] in EXECUTE("SELECT * FROM LIMIT 1") My code is like this : qdevedor->append(); qdevedor->Fields['de_cpfcnpj'] = $this->edcpf->text; qdevedor->Fields['de_nome'] = $this->ednome->text; qdevedor->post(); This is not working, but i can do the same insert manually, executing a INSERT clause. Can't i do the insert using the query's post method, just in the Delphi for Win32 ? Thanks in advance. |
| Sponsored Links |
|
|
|
|||
|
> {quote:title=Delphi-PHP Forums wrote:}{quote}
> http://tinyurl.com/qdohae > Hello, Thank you for your reply. I've changed my limits both -1, but now it insert a new record even i calling the edit method ie, it does not edit , but instead insert a new record... Any other idea ? Thanks. |
|
|||
|
> {quote:title=Delphi-PHP Forums wrote:}{quote}
> daniel costa;13365 Wrote: > > > > > Any other idea ? > > > > > > Forget the component and do it the 'old fashioned' way > > PHP code: > -------------------- > > $sql="update `salespeople` set `$column`=$change where `slsno`=$sls"; > $result=mysql_query($sql); > > -------------------- Well, this way works, i already tried before. But it's a lot of work, as i have more than 20 fields in the screen... So it's really a bug in the Query component ? Thanks. |
|
|||
|
So far, i can't edit any record in D4PHP.
The query's post method ALWAYS insert a new record, no matter if it is in insert or edit state ; actually, it can be in browse state and the post method will even insert a new record. I'm wonder if nobody had this problem yet ? Thanks |
|
|||
|
Quote:
If your data hasn't an unique key in retrieved data, driver is unable to build an "UPDATE TABLE SET col=value, col1=value1, col2=value2, ... WHERE cond1 AND cond2 AND ..." where each condition is necessary to identify the modified record. If your query isn't a plain SELECT * FROM TABLE WHERE filtering-condition not all drivers can query DDL to obtain necessary info to build updateable query to process. |