php-general Digest 25 Apr 2012 08:45:18 -0000 Issue 7788

Topics (messages 317668 through 317673):

Re: NULL Problem
        317668 by: Matijn Woudt
        317669 by: Serge Fonville
        317670 by: David Stoltz
        317671 by: David Stoltz

What is wrong here?
        317672 by: Karl-Arne Gjersøyen
        317673 by: marco.behnke.biz

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz <dsto...@shh.org> wrote:
> Here's my code (using MSSQL):
>
> $conn = new COM ("ADODB.Connection")or die("Cannot start ADO");
> $conn->open($connStr);
> $query = "SELECT * FROM TABLE WHERE id = ".$id;
> $rs = $conn->execute($query);
>
> This code works fine, and I retrieve the values like this:
>
> $tmp1 = $rs->fields("column1");
> $tmp2 = $rs->fields("column2");
> Etc...
>
>
> Here's the problem - I'm trying to get a date column that I know is
> NULL, but I can't seem to get my code right:
>
> $tmp = $rs->fields("followup_on");
> if(is_null($tmp)){
>        $followup = "";
> }else{
>        $followup = $rs->fields("followup_on");
> }
>
> //this results in: Catchable fatal error: Object of class variant could
> not be converted to string
> //When I try to ECHO the $followup results (and I know the database
> value is NULL)
>
>
> So confused - any advice?
>

It's been a long time ago I worked with ADO (Thank god), but shouldn't
you echo $followup->value instead of $followup?
If that's not working, try a var_dump($followup), so you can check
exactly what it is.

- Matijn

--- End Message ---
--- Begin Message ---
Have you considered the PHP MSSQL driver?
http://www.microsoft.com/download/en/details.aspx?id=20098

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Google!!
They need to add GAL support on Android (star to agree)
http://code.google.com/p/android/issues/detail?id=4602


2012/4/24 Matijn Woudt <tijn...@gmail.com>:
> On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz <dsto...@shh.org> wrote:
>> Here's my code (using MSSQL):
>>
>> $conn = new COM ("ADODB.Connection")or die("Cannot start ADO");
>> $conn->open($connStr);
>> $query = "SELECT * FROM TABLE WHERE id = ".$id;
>> $rs = $conn->execute($query);
>>
>> This code works fine, and I retrieve the values like this:
>>
>> $tmp1 = $rs->fields("column1");
>> $tmp2 = $rs->fields("column2");
>> Etc...
>>
>>
>> Here's the problem - I'm trying to get a date column that I know is
>> NULL, but I can't seem to get my code right:
>>
>> $tmp = $rs->fields("followup_on");
>> if(is_null($tmp)){
>>        $followup = "";
>> }else{
>>        $followup = $rs->fields("followup_on");
>> }
>>
>> //this results in: Catchable fatal error: Object of class variant could
>> not be converted to string
>> //When I try to ECHO the $followup results (and I know the database
>> value is NULL)
>>
>>
>> So confused - any advice?
>>
>
> It's been a long time ago I worked with ADO (Thank god), but shouldn't
> you echo $followup->value instead of $followup?
> If that's not working, try a var_dump($followup), so you can check
> exactly what it is.
>
> - Matijn
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Matijn - it worked! Geez...

Strange - I don't need the ->value if it actually has a value, only if it's 
NULL...

But it works! Thanks!

-----Original Message-----
From: Matijn Woudt [mailto:tijn...@gmail.com] 
Sent: Tuesday, April 24, 2012 1:40 PM
To: David Stoltz
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] NULL Problem

On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz <dsto...@shh.org> wrote:
> Here's my code (using MSSQL):
>
> $conn = new COM ("ADODB.Connection")or die("Cannot start ADO");
> $conn->open($connStr);
> $query = "SELECT * FROM TABLE WHERE id = ".$id;
> $rs = $conn->execute($query);
>
> This code works fine, and I retrieve the values like this:
>
> $tmp1 = $rs->fields("column1");
> $tmp2 = $rs->fields("column2");
> Etc...
>
>
> Here's the problem - I'm trying to get a date column that I know is
> NULL, but I can't seem to get my code right:
>
> $tmp = $rs->fields("followup_on");
> if(is_null($tmp)){
>        $followup = "";
> }else{
>        $followup = $rs->fields("followup_on");
> }
>
> //this results in: Catchable fatal error: Object of class variant could
> not be converted to string
> //When I try to ECHO the $followup results (and I know the database
> value is NULL)
>
>
> So confused - any advice?
>

It's been a long time ago I worked with ADO (Thank god), but shouldn't
you echo $followup->value instead of $followup?
If that's not working, try a var_dump($followup), so you can check
exactly what it is.

- Matijn

--- End Message ---
--- Begin Message ---
Serge,

We don't use MSSQL for much, mostly use MySQL...

But I don't want to switch out all the drivers for this one issue, which is now 
resolved (thanks Matijn)


-----Original Message-----
From: Serge Fonville [mailto:serge.fonvi...@gmail.com] 
Sent: Tuesday, April 24, 2012 1:45 PM
To: Matijn Woudt
Cc: David Stoltz; php-gene...@lists.php.net
Subject: Re: [PHP] NULL Problem

Have you considered the PHP MSSQL driver?
http://www.microsoft.com/download/en/details.aspx?id=20098

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Google!!
They need to add GAL support on Android (star to agree)
http://code.google.com/p/android/issues/detail?id=4602


2012/4/24 Matijn Woudt <tijn...@gmail.com>:
> On Tue, Apr 24, 2012 at 7:29 PM, David Stoltz <dsto...@shh.org> wrote:
>> Here's my code (using MSSQL):
>>
>> $conn = new COM ("ADODB.Connection")or die("Cannot start ADO");
>> $conn->open($connStr);
>> $query = "SELECT * FROM TABLE WHERE id = ".$id;
>> $rs = $conn->execute($query);
>>
>> This code works fine, and I retrieve the values like this:
>>
>> $tmp1 = $rs->fields("column1");
>> $tmp2 = $rs->fields("column2");
>> Etc...
>>
>>
>> Here's the problem - I'm trying to get a date column that I know is
>> NULL, but I can't seem to get my code right:
>>
>> $tmp = $rs->fields("followup_on");
>> if(is_null($tmp)){
>>        $followup = "";
>> }else{
>>        $followup = $rs->fields("followup_on");
>> }
>>
>> //this results in: Catchable fatal error: Object of class variant could
>> not be converted to string
>> //When I try to ECHO the $followup results (and I know the database
>> value is NULL)
>>
>>
>> So confused - any advice?
>>
>
> It's been a long time ago I worked with ADO (Thank god), but shouldn't
> you echo $followup->value instead of $followup?
> If that's not working, try a var_dump($followup), so you can check
> exactly what it is.
>
> - Matijn
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hello again.
I can't figure out what is wrong here.

move_uploaded_file() get error message from die() and can't copy/move
temp_file into directory bilder

I have try to chmod 0777 bilder/ but it did not help.
Also I have try to chown www-data.www-data bilder/ since Ubuntu Server
run apache as www-data user...

Here is my souce code
------------------------------------------------------
// Temfil lagres midlertidig på serveren som
        // spesifisert i php.ini
        $tmp_fil = $_FILES['filbane']['temp_name'];
        // lagre filnavnet..
        $filnavn = "bilder/" . $_FILES['filbane']['name'];
        // ..og legg fila i katalogen bilder
        move_uploaded_file($tmp_fil, $filnavn) or die("Feilmelding: Kunne
ikke flytte $filnavn");
        

Karl

--- End Message ---
--- Begin Message ---

"Karl-Arne Gjersøyen" <karlar...@gmail.com> hat am 25. April 2012 um 06:45
geschrieben:

> Hello again.
> I can't figure out what is wrong here.
>
> move_uploaded_file() get error message from die() and can't copy/move
> temp_file into directory bilder
>
> I have try to chmod 0777 bilder/ but it did not help.
> Also I have try to chown www-data.www-data bilder/ since Ubuntu Server
> run apache as www-data user...
>
> Here is my souce code
> ------------------------------------------------------
> // Temfil lagres midlertidig på serveren som
>         // spesifisert i php.ini
>         $tmp_fil = $_FILES['filbane']['temp_name'];

tmp_name not temp_name

--- End Message ---

Reply via email to