且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查询不一致(MySQL与PHP) - >日期格式

更新时间:2023-02-01 22:41:48

query =" SELECT" 。


this-> tabela3。 .id, 。


this-> tabela3。

" .naziv,"

<?
$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;
i guess that it has somethnig to do with ''%e. %c. %Y. %k:%i'' part of the
DATE_TIME parameters not escaped right, but the same parameters work
when querying only one table without conditional statement.

looking forward to see answers to this puzzle.

query = "SELECT " .


this->tabela3 . ".id, " .


this->tabela3 .
".naziv, " .