git-svn-id: https://msi/svn/firstRepo/Service/branches/Manut_2.2.3@87 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2016-05-17 10:47:12 +00:00
parent 9533309b58
commit 6754a2060b
+4 -2
View File
@@ -56,7 +56,8 @@ $app->get('/ricette/:catID', function ($categoryID) use ($app) {
$mysqlconnetion = new MysqlClass; $mysqlconnetion = new MysqlClass;
//$mysqlconnetion->connetti(); //$mysqlconnetion->connetti();
$query = "select * from (select ID as ricetta_id, titolo, autore, valutazione, difficolta, " . $query = "select * from (select ID as ricetta_id, titolo, autore, valutazione, difficolta, " .
"(select id from immagini where immagini.id_ricette = ricette.id and bCover = 1) as firstImage " . "(select id from immagini where immagini.id_ricette = ricette.id and bCover = 1) as firstImage, " .
"(select count(id) from immagini where immagini.id_ricette = ricette.id) as countImages " .
"from ricette where ricette.ID_CATEGORIA = " . $categoryID . " order by titolo, autore) as TMP"; "from ricette where ricette.ID_CATEGORIA = " . $categoryID . " order by titolo, autore) as TMP";
$retObj = $mysqlconnetion->queryToObject($query); $retObj = $mysqlconnetion->queryToObject($query);
$mysqlconnetion->disconnetti(); $mysqlconnetion->disconnetti();
@@ -122,7 +123,8 @@ $app->get('/ricette/search/:numItems/:startItem(/:categoryId(/:difficolta/:autor
$queryBase = $queryBase . " order by titolo, autore"; $queryBase = $queryBase . " order by titolo, autore";
$query = "select * from (select ricette.ID as ricetta_id, categorie.name AS categoria_name, titolo, autore, valutazione, difficolta, " . $query = "select * from (select ricette.ID as ricetta_id, categorie.name AS categoria_name, titolo, autore, valutazione, difficolta, " .
"(select id from immagini where immagini.id_ricette = ricette.id and bCover = 1) as firstImage" . "(select id from immagini where immagini.id_ricette = ricette.id and bCover = 1) as firstImage, " .
"(select count(id) from immagini where immagini.id_ricette = ricette.id) as countImages" .
$queryBase . " LIMIT " . $numItems * $startItem . " , " . $numItems . ") as TMP"; $queryBase . " LIMIT " . $numItems * $startItem . " , " . $numItems . ") as TMP";
$retObj2 = $mysqlconnetion->queryToObject($query); $retObj2 = $mysqlconnetion->queryToObject($query);