Re: [PHP] Fwd: What wrong am I doing now?

[email protected] (Sebastian Krebs)
Newsgroups php.general
Message-ID <CALtuQzAuNjq6dBdw8LeKGTfjOToDjWSTe8_+63-zTXJnvO8t0w@mail.gmail.com>
Hi,

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

Regards,
Sebastian


2013/7/24 Karl-Arne Gjersøyen <[email protected]>

> 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 <[email protected]>
> Date: 2013/7/24
> Subject: What wrong am I doing now?
> To: PHP Mailinglist <[email protected]>
>
>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.