|
From: <al...@us...> - 2008-08-27 16:31:20
|
Revision: 648
http://sciret.svn.sourceforge.net/sciret/?rev=648&view=rev
Author: alpeb
Date: 2008-08-27 16:31:18 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
fixed some db calls
Modified Paths:
--------------
trunk/models/Article.php
trunk/models/Todo.php
Modified: trunk/models/Article.php
===================================================================
--- trunk/models/Article.php 2008-08-27 15:06:00 UTC (rev 647)
+++ trunk/models/Article.php 2008-08-27 16:31:18 UTC (rev 648)
@@ -463,7 +463,7 @@
$query = 'SELECT art_id, related_art_id FROM articles_related WHERE art_id=?';
$result = DB::getInstance()->query($query, $this->id);
$this->relatedArticles = array();
- while ($row = $result->fetch()) {
+ foreach ($result->fetchAll(Zend_Db::FETCH_ASSOC) as $row) {
$this->relatedArticles[] = new Article($row['related_art_id']);
}
}
Modified: trunk/models/Todo.php
===================================================================
--- trunk/models/Todo.php 2008-08-27 15:06:00 UTC (rev 647)
+++ trunk/models/Todo.php 2008-08-27 16:31:18 UTC (rev 648)
@@ -47,7 +47,7 @@
$query = 'SELECT todo_id, related_art_id FROM todos_related WHERE todo_id=?';
$result = DB::getInstance()->query($query, $this->id);
$this->relatedArticles = array();
- while ($row = $result->fetch()) {
+ foreach ($result->fetchAll(Zend_Db::FETCH_ASSOC) as $row) {
$this->relatedArticles[] = new Article($row['related_art_id']);
}
}
@@ -92,13 +92,13 @@
foreach ($this->relatedArticles as $article) {
$query = 'INSERT INTO todos_related (todo_id, related_art_id) VALUES (?, ?)';
- DB::getInstance()->query($query, $this->id, $article->getId());
+ DB::getInstance()->query($query, array($this->id, $article->getId()));
}
}
function deleteRelatedArticle($artId) {
$query = 'DELETE FROM todos_related WHERE todo_id=? AND related_art_id=?';
- DB::getInstance()->query($query, $this->id, $artId);
+ DB::getInstance()->query($query, array($this->id, $artId));
}
function save() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|