I've used MySQLi_STMT class to execute the query and it inserted empty
values. It doesn't give any error and mysqli_stmt->error is empty.
Here is the code:
$mysqli = new mysqli('host', 'my-username', 'my-password', 'database');
$stmt = $mysqli->prepare("INSERT INTO test(content) VALUES(?)");
$value = 'value';
$stmt->bind_param("s", $value);
$stmt->execute();
$stmt->close();
$mysqli->close();
Now at least i know that the problem is not Zend Framework related.
On Wed, Jul 23, 2008 at 11:37 PM, sempsteen <sempsteen@gmail.com> wrote:
> I've tried executing a very basic insert query by using mysqli class
> for testing.
> Here is the code i've used:
>
> $mysqli = new mysqli('host', 'my-username', 'my-password', 'database');
> $mysqli->query("INSERT INTO test(content) VALUES('try try try')");
>
> This works properly. So i need more experiments to find out the
> solution. I'll continue trying as i have free time and i'm going to
> write my results.
>
> On Mon, Jul 21, 2008 at 1:51 PM, sempsteen <sempsteen@gmail.com> wrote:
>> It works on my local computer. I have:
>> - PHP 5.2.4
>> - MySQL 5.0.51a,
>>
>> On server INSERT doesn't work properly but i haven't had any issues
>> with SELECT. Server configuration is:
>> - PHP 5.2.5
>> - MySQL 4.1.22
>>
>> Where do i need to look for a solution?
>> Thanks.
>>
>>
>> On Mon, Jul 21, 2008 at 10:05 AM, Maxim Savenko <maxim.savenko@gmail.com> wrote:
>>> Yesterday, I tried to change db driver in my project from pdo_mysql to
>>> mysqli, and there was the same behavior. All select operations was ok, but
>>> no success insertion occured. I use mysql 5.1 and php 5.2.6 + ZF 1.5.2. I
>>> noticed that in php.log the 'Unhandled Exception in line 0' string
>>> appeared.
>>>
>>>
>>> PS: I think we have found a bug :)
>>>
>>>
>>> 2008/7/21 sempsteen <sempsteen@gmail.com>:
>>>>
>>>> Hi all,
>>>> I'm using Mysqli extension. When i try to insert a data to the
>>>> database it always inserts empty strings. I've searched for solution
>>>> but couldn't find anything. In PHP documentation it says:
>>>> The mysqli extension is designed to work with the version 4.1.3 or
>>>> above of MySQL. For previous versions, please see the MySQL extension
>>>> documentation.
>>>> And my server has MySQL v4.1.22. Do you think this is because of my
>>>> MySQL version?
>>>> Thanks.
>>>>
>>>
>>>
>>>
>>> --
>>> Good Luck.
>>>
>>> Maxim Savenko
>>> EMail: maxim.savenko@gmail.com
>>
>
没有评论:
发表评论