Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 452
  • Last Modified:

MySQL query table not found error

Hello all.

Super easy question but I just can't seem to find the syntax error.

I'm getting the error "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'techatco_mage.t' doesn't exist"

from the query attached. For some reason it is taking the alias as the table.

Could anyone help? Thanks much.


$sqry = "select t.topic_id from ".$faqsTopicTable." t,".$faqsStoreTable." s WHERE t.default='1'
                                 and t.topic_id = s.topic_id
                                 and s.store_id= ".Mage::app()->getStore()->getId()."
                                 order by update_time desc limit 1;";

Open in new window

0
techatcost
Asked:
techatcost
  • 2
1 Solution
 
cyberkiwiCommented:
Your variable $faqsTopicTable has an extra "." at the end. Inspect it
0
 
cyberkiwiCommented:
You can use
die($faqsTopicTable . "---");
just before the current line to see what is in there
0
 
techatcostAuthor Commented:
I got it. It was actually a variable declaration problem. Something sneaky with the ecommerce platform I'm using. The query works now. Thanks  - awarding points for your reply.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now