Re: Error to insert in firebird
| From: | Tsvetan Nikolov | Date: | Tue, 05 Nov 2013 19:57:04 +0000 |
| Subject: | Re: Error to insert in firebird | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322433@lists.php.net to get a copy of this message | ||
Oh yeah and you may want to try declaring your $param as array. $param =
array('1', 'Test1');
On Tue, Nov 5, 2013 at 8:55 PM, Tsvetan Nikolov <live.webscore@gmail.com>wrote:
> Sorry I have no experience with firebird commands.
>
> Just read through the official documentation. If I am to take a blind
> guess I would point to ibase_prepare($tr,$param); and would say that the
> variable $param does not belong there but rather in ibase_execute. What I
> would try is something like this:
>
>
> $sql = "insert into scele (codigo, nombre) values (?, ?)";
> $param = "1, Test1";
>
> $tr = ibase_trans(IBASE_WRITE,$this->cn);
> $qr = ibase_prepare($this->cn, $tr, $sql);
> $this->rs = ibase_execute($qr,$param);
> .......
>
> If this doesn't work remove the parameters and put static values and see
> if that works...etc... you have to really debug line by line.
>
> Good luck!
>
>
>
>
> On Tue, Nov 5, 2013 at 8:30 PM, Ismael L. Donis Garcia <
> ismael@citricos.co.cu> wrote:
>
>> $sql = "insert into scele (codigo, nombre) values (?, ?)";
>> $param = "1, Test1";
>>
>> $tr = ibase_trans(IBASE_WRITE,$this->cn);
>> $qr = ibase_prepare($tr,$param);
>> echo ibase_errmsg() ."<br>";
>> Dynamic SQL Error SQL error code = -104 Token unknown - line 1, column 1 2
>>
>> But I do not understand as it can be the error.
>>
>> Best Regards
>> ========
>> | ISMAEL |
>> ========
>>
>> ----- Original Message -----
>> From: Tsvetan Nikolov
>> To: Ismael L. Donis Garcia
>> Cc: PHP-General
>> Sent: Tuesday, November 05, 2013 1:53 PM
>> Subject: Re: [PHP] Error to insert in firebird
>>
>>
>> Well,
>>
>> in the documentation it says that if the query raises an error, returns
>> FALSE. You should start calling ibase_errmsg to track where the error is.
>>
>>
>>
>>
>> On Tue, Nov 5, 2013 at 7:34 PM, Ismael L. Donis Garcia <
>> ismael@citricos.co.cu> wrote:
>>
>> ----- Original Message ----- From: Tsvetan Nikolov
>> To: Ismael L. Donis Garcia
>> Cc: PHP-General
>> Sent: Tuesday, November 05, 2013 12:45 PM
>> Subject: Re: [PHP] Error to insert in firebird
>>
>>
>> Do you commit your transaction?
>>
>>
>> Yes
>>
>> The complete function is:
>>
>> public function actualizar($sql,$param){
>> if ($this->cn){
>>
>> //for example:
>>
>> $sql = "insert into scele (codigo, nombre) values (?, ?)";
>> $param = "1, Test1";
>>
>> $tr = ibase_trans(IBASE_WRITE,$this->cn);
>> $qr = ibase_prepare($tr,$param);
>> $this->rs = ibase_execute($sql,$param);
>> if ($this->rs){
>>
>> //Evaluate this condition, but he does not enter here
>>
>>
>> ibase_commit($tr);
>> } else {
>> ibase_rollback($tr);
>> return array('tipo'=>false,'texto'=>'Error de
>> ejecusión:
>> ' .ibase_errmsg());
>> }
>> ibase_free_query($qr);
>> return array('tipo'=>true,'texto'=>'');
>> } else {
>> return array('tipo'=>false,'texto'=>'Error de
>> conexión: '
>> .ibase_errmsg());
>>
>> }
>> }
>>
>> Best Regards
>> ========
>> | ISMAEL |
>> ========
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>