You are here: Re: Query inconsistency (MySQL vs PHP) -> DATE_FORMAT « All PHP « IT news, forums, messages
Re: Query inconsistency (MySQL vs PHP) -> DATE_FORMAT

Posted by laverdir on 03/15/07 15:33

Steve wrote:
> "laverdir" <MOVE-RE_ME_laverdir@post.t-com.hr> wrote in message
> news:et78o5$r8g$1@ss408.t-com.hr...
> | <?
> | $query = "SELECT " . $this->tabela3 . ".id, " . $this->tabela3 .
> | ".naziv, " . $this->tabela3 . ".spisatelj, " . $this->tabela3 .
> | ".najava, " . " DATE_FORMAT(" . $this->tabela3 . ".vrijeme_stavljanja,
> | '%e. %c. %Y. %k:%i') FROM " . $this->tabela3 . ", " . $this->tabela2 .
> | " AS xref WHERE " . $this->tabela3 . ".id=xref.spis_id AND
> | xref.vrsta_id=" . $this->DB->quote($vrsta) . " ORDER BY " .
> | $this->tabela3 . ".vrijeme_stavljanja DESC";
> | ?>
> |
> | php query doesn't return formated date and time, while this works
> | through console window:
> |
> | SELECT spisi.id, spisi.naziv, spisi.spisatelj, spisi.najava, DATE_FORMAT
> | (spisi.vrijeme_stavljanja, '%e. %c. %Y. %k:%i') FROM spisi,
> | spis_vrsta_xref AS xref WHERE spisi.id=xref.spis_id AND
> | xref.vrsta_id="7" ORDER BY spisi.vrijeme_stavljanja DESC;
>
> surely $query doesn't look like this in your code. i assume it looks like
> shit here b/c of the way your usenet client wrapped the text...right. i'd be
> a fool to believe anyone would intentionally create unmanageble inline sql
> statements. i mean, everyone knows that some employers would pass over
> otherwise qualified applicants otherwise. i'm sure the statement you have in
> real life looks something like this:
>
> $sql = "
> SELECT a.id ,
> a.naziv ,
> a.spisatelj ,
> a.najava ,
> DATE_FORMAT(a.vrijeme_stavljanja, '%e. %c. %Y %k:%i)
> stamp ,
> FROM " . $this->tabela3 . " a
> JOIN " . $this->tabela2 . " b
> ON a.id = b.spis_id
> WHERE b.vrsta_id = '" . $this->DB->quote($vrsta) .
> "'
> ORDER BY a.vrijeme_stavljanja DESC
> ";
>
> i knew that was what you meant. ;^)
>
>

it looked similar to this when the query was in
designing proces, but then squizeed to one line
for space saving..

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация