php-general Digest 26 Jul 2013 09:18:07 -0000 Issue 8310

Topics (messages 321704 through 321715):

Re: What wrong am I doing now?
        321704 by: Karl-Arne Gjersøyen
        321705 by: Matijn Woudt
        321706 by: Sebastian Krebs
        321707 by: Jim Giner
        321708 by: Matijn Woudt
        321709 by: Jim Giner

Quick Q.
        321710 by: Richard Quadling
        321711 by: Matijn Woudt
        321713 by: Richard Quadling
        321714 by: Matijn Woudt

Re: COM - Assigning to method.
        321712 by: Richard Quadling

>From 24/7/2013 to 2013-07-24
        321715 by: Karl-Arne Gjersøyen

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 ---
http://www.php.net/manual/en/datetime.format.php have the solution. Sorry
for asking before I look at php.net!!!

Karl

---------- Forwarded message ----------
From: Karl-Arne Gjersøyen <karlar...@gmail.com>
Date: 2013/7/24
Subject: What wrong am I doing now?
To: PHP Mailinglist <php-gene...@lists.php.net>


mysql> SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC;
+-------------------------------+
| DATE_FORMAT(dato, '%e-%c-%Y') |
+-------------------------------+
| 24-7-2013                     |
| 23-7-2013                     |
+-------------------------------+
2 rows in set (0.00 sec)

mysql>


// My PHP code looks like this.
// -----------------------------------------
$sql = "SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());

while($rad = mysql_fetch_array($resultat)){
$dato = $rad['dato'];
var_dump($dato);

I gott NULL,NULL here and believe it is something with my PHP Source that
is wrong when using DATE_FORMAT. As you see above it work in terminal.

I hope this not is off-topic for the list. If so, I am sorry for it and
hope you can give me advice about a good MySQL list for newbie's.

Thanks again for your help!

Karl

--- End Message ---
--- Begin Message ---
On Wed, Jul 24, 2013 at 2:19 PM, Karl-Arne Gjersøyen <karlar...@gmail.com>wrote:

> mysql> SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
> dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC;
> +-------------------------------+
> | DATE_FORMAT(dato, '%e-%c-%Y') |
> +-------------------------------+
> | 24-7-2013                     |
> | 23-7-2013                     |
> +-------------------------------+
> 2 rows in set (0.00 sec)
>
> mysql>
>
>
> // My PHP code looks like this.
> // -----------------------------------------
> $sql = "SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
> dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC";
> $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
>
> while($rad = mysql_fetch_array($resultat)){
> $dato = $rad['dato'];
>

$rad['dato'] probably doesn't exist because you used DATE_FORMAT.
Either use $rad[0], or use the following SQL:

$sql = "SELECT DATE_FORMAT(dato, '%e-%c-%Y') AS dato FROM transportdokument
WHERE dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC";

Regards,

Matijn

--- End Message ---
--- Begin Message ---
Hi,

Just want to mention: ext/mysel is deprecated. Use MySQLi, or PDO_MYSQL
instead. :)

Regards,
Sebastian


2013/7/24 Karl-Arne Gjersøyen <karlar...@gmail.com>

> http://www.php.net/manual/en/datetime.format.php have the solution. Sorry
> for asking before I look at php.net!!!
>
> Karl
>
> ---------- Forwarded message ----------
> From: Karl-Arne Gjersøyen <karlar...@gmail.com>
> Date: 2013/7/24
> Subject: What wrong am I doing now?
> To: PHP Mailinglist <php-gene...@lists.php.net>
>
>
> mysql> SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
> dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC;
> +-------------------------------+
> | DATE_FORMAT(dato, '%e-%c-%Y') |
> +-------------------------------+
> | 24-7-2013                     |
> | 23-7-2013                     |
> +-------------------------------+
> 2 rows in set (0.00 sec)
>
> mysql>
>
>
> // My PHP code looks like this.
> // -----------------------------------------
> $sql = "SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
> dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC";
> $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
>
> while($rad = mysql_fetch_array($resultat)){
> $dato = $rad['dato'];
> var_dump($dato);
>
> I gott NULL,NULL here and believe it is something with my PHP Source that
> is wrong when using DATE_FORMAT. As you see above it work in terminal.
>
> I hope this not is off-topic for the list. If so, I am sorry for it and
> hope you can give me advice about a good MySQL list for newbie's.
>
> Thanks again for your help!
>
> Karl
>



-- 
github.com/KingCrunch

--- End Message ---
--- Begin Message ---
On 7/24/2013 8:19 AM, Karl-Arne Gjersøyen wrote:
mysql> SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC;
+-------------------------------+
| DATE_FORMAT(dato, '%e-%c-%Y') |
+-------------------------------+
| 24-7-2013                     |
| 23-7-2013                     |
+-------------------------------+
2 rows in set (0.00 sec)

mysql>


// My PHP code looks like this.
// -----------------------------------------
$sql = "SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());

while($rad = mysql_fetch_array($resultat)){
$dato = $rad['dato'];
var_dump($dato);

I gott NULL,NULL here and believe it is something with my PHP Source that
is wrong when using DATE_FORMAT. As you see above it work in terminal.

I hope this not is off-topic for the list. If so, I am sorry for it and
hope you can give me advice about a good MySQL list for newbie's.

Thanks again for your help!

Karl

Add a check on the query result to be sure your query actually ran.
> $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
>
if (!$resultat)
{
   echo "Query failed to run - ".mysql_error();
   exit();
}
> while($rad = mysql_fetch_array($resultat)){
....
...


--- End Message ---
--- Begin Message ---
On Wed, Jul 24, 2013 at 2:45 PM, Jim Giner <jim.gi...@albanyhandball.com>wrote:

> On 7/24/2013 8:19 AM, Karl-Arne Gjersøyen wrote:
>
>> mysql> SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
>> dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC;
>> +-----------------------------**--+
>> | DATE_FORMAT(dato, '%e-%c-%Y') |
>> +-----------------------------**--+
>> | 24-7-2013                     |
>> | 23-7-2013                     |
>> +-----------------------------**--+
>> 2 rows in set (0.00 sec)
>>
>> mysql>
>>
>>
>> // My PHP code looks like this.
>> // ------------------------------**-----------
>> $sql = "SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
>> dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC";
>> $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
>>
>> while($rad = mysql_fetch_array($resultat)){
>> $dato = $rad['dato'];
>> var_dump($dato);
>>
>> I gott NULL,NULL here and believe it is something with my PHP Source that
>> is wrong when using DATE_FORMAT. As you see above it work in terminal.
>>
>> I hope this not is off-topic for the list. If so, I am sorry for it and
>> hope you can give me advice about a good MySQL list for newbie's.
>>
>> Thanks again for your help!
>>
>> Karl
>>
>>  Add a check on the query result to be sure your query actually ran.
>
> > $resultat = mysql_query($sql, $tilkobling) or die(mysql_error());
> >
> if (!$resultat)
> {
>    echo "Query failed to run - ".mysql_error();
>    exit();
> }
> > while($rad = mysql_fetch_array($resultat)){
> ....
> ...
>
>
Jim,

He already has that...

- Matijn

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

Jim,

He already has that...

- Matijn

oops

--- End Message ---
--- Begin Message ---
PHP 5.5+ is (from news)

   - Windows XP and 2003 support dropped.

Does that mean no longer executes (as is seemingly what I'm seeing) or just
no longer supported/developed?

Just going to look into getting to the bottom of the CHM build issues and
only have an XP license of Windows.

Will drop back to PHP 5.4 to see if that's OK on the VM I have.


-- 
Richard Quadling

--- End Message ---
--- Begin Message ---
On Wed, Jul 24, 2013 at 10:45 PM, Richard Quadling <rquadl...@gmail.com>wrote:

> PHP 5.5+ is (from news)
>
>    - Windows XP and 2003 support dropped.
>
> Does that mean no longer executes (as is seemingly what I'm seeing) or just
> no longer supported/developed?
>
> Just going to look into getting to the bottom of the CHM build issues and
> only have an XP license of Windows.
>
> Will drop back to PHP 5.4 to see if that's OK on the VM I have.
>
>
> Hi,

It is only no longer supported/developed. It probably will compile fine on
it for a long time, though some new features might not. It probably also
means they are not going to test on XP/2003 anymore, and will not respond
to bugs related to these operating systems.

- Matijn

--- End Message ---
--- Begin Message ---
On 24 July 2013 21:54, Matijn Woudt <tijn...@gmail.com> wrote:

>
>
>
> On Wed, Jul 24, 2013 at 10:45 PM, Richard Quadling <rquadl...@gmail.com>wrote:
>
>> PHP 5.5+ is (from news)
>>
>>    - Windows XP and 2003 support dropped.
>>
>>
>> Does that mean no longer executes (as is seemingly what I'm seeing) or
>> just
>> no longer supported/developed?
>>
>> Just going to look into getting to the bottom of the CHM build issues and
>> only have an XP license of Windows.
>>
>> Will drop back to PHP 5.4 to see if that's OK on the VM I have.
>>
>>
>> Hi,
>
> It is only no longer supported/developed. It probably will compile fine on
> it for a long time, though some new features might not. It probably also
> means they are not going to test on XP/2003 anymore, and will not respond
> to bugs related to these operating systems.
>
> - Matijn
>
>
>From what I can see, PHP V5.5.1 (just downloaded onto a clean VM) fails to
execute. But V5.4.17 works fine.

-- 
Richard Quadling
Twitter : @RQuadling

--- End Message ---
--- Begin Message ---
On Wed, Jul 24, 2013 at 10:59 PM, Richard Quadling <rquadl...@gmail.com>wrote:

>
>
>
> On 24 July 2013 21:54, Matijn Woudt <tijn...@gmail.com> wrote:
>
>>
>>
>>
>> On Wed, Jul 24, 2013 at 10:45 PM, Richard Quadling 
>> <rquadl...@gmail.com>wrote:
>>
>>> PHP 5.5+ is (from news)
>>>
>>>    - Windows XP and 2003 support dropped.
>>>
>>>
>>> Does that mean no longer executes (as is seemingly what I'm seeing) or
>>> just
>>> no longer supported/developed?
>>>
>>> Just going to look into getting to the bottom of the CHM build issues and
>>> only have an XP license of Windows.
>>>
>>> Will drop back to PHP 5.4 to see if that's OK on the VM I have.
>>>
>>>
>>> Hi,
>>
>> It is only no longer supported/developed. It probably will compile fine
>> on it for a long time, though some new features might not. It probably also
>> means they are not going to test on XP/2003 anymore, and will not respond
>> to bugs related to these operating systems.
>>
>> - Matijn
>>
>>
> From what I can see, PHP V5.5.1 (just downloaded onto a clean VM) fails to
> execute. But V5.4.17 works fine.
>
> --
> Richard Quadling
> Twitter : @RQuadling
>

The precompiled version indeed does not work on XP/2003, but I think you
can still compile it yourself for windows XP.

- Matijn

--- End Message ---
--- Begin Message ---
On 15 July 2013 16:27, Andrew Ballard <aball...@gmail.com> wrote:

> On Mon, Jul 15, 2013 at 4:21 AM, Adam Nicholls <inkysp...@gmail.com>
> wrote:
> > Hi Andrew
> >
> > Thanks for this.
> >
> > But I'm still getting errors. I think I need to explain a bit more.
> >
> > Unfortunately there isn't a PHP API for this application I'm trying to
> > interact with, my goal really is to be able to expose the COM
> > functionality over a web-service such as SOAP so I can use it in a
> > CMS. The application I'm trying to integrate with is Blackbuad's
> > Raiser's Edge - API documentation here:
> > https://www.blackbaud.com/files/support/guides/re7ent/api.pdf
> >
> > I think part of the problem is that the field names are also
> > represented by an integer. So to get data out I would do:
> >
> > $oBank->Fields(22);   // which maps to BANK_fld_BRANCH_NAME.
> >
> > When I do:
> >
> > $oBank->22 = 'blah blah';
> >
> > I get an error because a property can't be numeric, it has to start as
> > alpha character. If I use:
> >
> > $oBank->BANK_fld_BRANCH_NAME = 'blah blah blah';
> >
> > I get the following error:
> >
> > Fatal error: Uncaught exception 'com_exception' with message 'Unable
> > to lookup `BANK_fld_BRANCH_NAME': Unknown name.
> >
> > I've also tried using your Value property returned by Fields():
> >
> > $oBank->Fields(22)->Value = 'Blah Blah blah blah';
> >
> > Which I then get:
> > PHP Warning:  Creating default object from empty value in [C:\Users....]
> > Fatal error: Call to undefined method variant::Save()
> >
> > Soo seems nearly impossible to implement a safe way to write to the COM
> API.
> >
> >
> > At the moment, I'm still in the scoping/prototype stage of my project,
> > so I'm beginning to think that using this COM API for this project is
> > a no-go, which is unfortunate. I'm also guessing even if we did
> > implement this API, exposing it as a Web Service is going to be tricky
> > for performance sake (given that I've read that COM doesn't
> > multithread very well??)
> >
> > Many Thanks
> > Adam.
>
> It's definitely possible to do, once you figure out the syntax you
> need for this object.
>
> I'm guessing you must have gotten past the $oBank->Init() method call
> without issues.
>
> What happens if you just use this for the value assignment?
>
> $oBank->Fields(BANK_fld_ACCOUNT_NAME) = "Test account";
> $oBank->Fields(BANK_fld_ACCOUNT_NO) = "12345";
> $oBank->Fields(BANK_fld_BANK) = "Bank of the Nation";
> $oBank->Fields(BANK_fld_BRANCH_NAME) = "State Street Branch";
>
> It also looks like you're getting errors from the call to
> $oBank->Save() saying that the method is not defined.
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I used to use PHP+Windows+COM+Crystal Reports.

I'm in the middle of something else, but a few things. Does the library you
are using have a valid COM interface? Some of the .NET libraries simply
don't. The last version of CR that was COM enabled was CR XI R 2. After
that it was .NET and Java only. No COM. Having said that, I never got
around to using http://uk1.php.net/manual/en/class.dotnet.php, so I don't
know how this all worked. From memory the DOTNET layer of PHP was just a
wrapper around COM and still required COM exposure in the lib. I think.

Use a TypeLib Explorer to see exactly what interface is available - from
memory, the right tool is all you need. I was able to code anything I
needed with Crystal Reports.

There is also a PHP function
http://uk1.php.net/manual/en/function.com-load-typelib.php which I used to
allow the various constants within the typelib to be exposed and usable
within PHP.

And also look at
http://uk1.php.net/manual/en/function.com-print-typeinfo.php and the user
notes. Not used it but "bucket loads of info" is a good thing to see
normally.


-- 
Richard Quadling
Twitter : @RQuadling

--- End Message ---
--- Begin Message ---
Below is something I try that ofcourse not work because of rsosort.
Here is my code:
-----------------------
$lagret_dato = $_POST['lagret_dato'];
    foreach($lagret_dato as $dag){

        $dag = explode("/", $dag);
       rsort($dag);
        $dag = implode("-", $dag);
        var_dump($dag);

What I want is a way to rewrite contents of a variable like this:

>From 24/7/2013 to 2013-07-24

Is there a way in PHP to do this?

Thank you very much.

Karl

--- End Message ---

Reply via email to