Thank you for your suggestion. Actually after examining the query, I foung
that there are 2 "approved" colums in the query result. One in articles
table and the other one was in user table. After executing the query code
was picking up the one in the user table which was "1". I changed the name
of the column in users table and now query working fine.
Sometimes long time coding, you can even see a simple point. I am copying
what I was facing. As you can see last approved column which one was 1, was
printed on the screen.
Thanks again...
articleID userID categoryID articleTitle articleHeader
articleBody articleDate approved categoryID categoryName
userID userName userPassword firstName lastName
email approved accessLevel
3 1 1 Test Test Test 28.12.2010 14:59 0
1 PHP 1 erdal.yazicioglu erdaly Erdal YAZICIOGLU
erdal.yazicioglu@gmail.com 1 0
-----Original Message-----
From: Bill Karwin [mailto:bill@karwin.com]
Sent: Tuesday, December 28, 2010 2:54 PM
To: fw-db@lists.zend.com
Subject: Re: [fw-db] Db Select prints wrong info
On Dec 28, 2010, at 5:27 AM, Erdal YAZICIOGLU wrote:
> It prints 1 instead of 0s for the pending articles.
Suggestions:
If you have more than one copy of Application_Model_DbTable_Articles
in your include path, make sure you're running the one you think you
are. Add a diagnostic print statement inside your pendingArticles()
method, to output __FILE__.
Use the Zend_Db_Profiler to examine the exact SQL you're executing.
Alternatively, look in the database query log to see the statement it
executed. It's easier to debug SQL by looking at SQL, not code that
constructs SQL.
Try the same SQL in your database query tool (e.g. MySQL Workbench or
the mysql CLI). What data does the query return?
Regards,
Bill Karwin
没有评论:
发表评论