Error Number 1096 No Tables Used Select
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might no tables used codeigniter have Meta Discuss the workings and policies of this site About
Error 1096 Mysql
Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads error number 1096 codeigniter with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million
Codeigniter Custom Query
programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MYSQL ERROR 1096 - NO TABLES USED - CODEIGNITER up vote 1 down vote favorite I am using a custom query as the Active Record equivelant did not work for me. When placing the Query in my Database Software SQLYOG it works fine however in CodeIgniter it says A Database Error Occurred Error Number: 1096 No tables used SELECT * Filename: C:\xampp\htdocs\midas\system\database\DB_driver.php Line Number: 330 Here is my Query: SELECT intervention.department_id, department_name, COUNT(*) FROM intervention LEFT JOIN department ON department.department_id = intervention.department_id GROUP BY intervention.department_id, department.department_name ORDER BY COUNT(*) desc LIMIT 1 It is a bit of a strange problem. Here is my Schema also: http://i.imgur.com/mKNtc.png php mysql database codeigniter share|improve this question asked Aug 3 '11 at 14:17 sqlmole 40741327 I don't think it's the posted query thats causing the error. –Jacob Aug 3 '11 at 14:20 Can you show the code that you build the query? –Alfonso Rubalcava Aug 3 '11 at 14:58 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote accepted EDIT This will not work. As noted below only COUNT(*) or COUNT(table.field) work. I think you need to specify which table you are using COUNT(*) on, so change it
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up No tables used? up vote -1 down vote favorite I've been working with this bit of http://stackoverflow.com/questions/6927940/mysql-error-1096-no-tables-used-codeigniter code for some time now, and now, after some tinkering, I thought i finally got it to work, then it gives me this error Error Number: 1096 No tables used SELECT * and this is the code SELECT start.*, posts.did, COUNT(posts.pid) FROM akia_starting_posts AS start JOIN posts ON posts.did = start.did JOIN akia_users AS users ON users.username = start.username I'm pretty sure at the * my start is being used, so http://stackoverflow.com/questions/15857251/no-tables-used what the heck is it talking about?? It couldn't be any other code in the file, since when I take out this bit of code, it starts working. sql table share|improve this question asked Apr 6 '13 at 23:43 Hikaru Kagi 56 1 Are you using Sql Server? –Steve Apr 6 '13 at 23:47 Please provide some context: What did you do? Did you execute the SQL you give? On what DBMS? What is the schema? How did you execute the SQL (which tool)? –sleske Apr 6 '13 at 23:47 @Steve I honestly don't know, I'm working on localhost with WAMP, if I think i know what you're referring to then I think I'm on MySQL (Sorry, bit of a newbie) –Hikaru Kagi Apr 6 '13 at 23:49 I will try to change that table name, use something less ambiguous. I don't know for MySql, but for example in Sql Server that word (START) is listed between the future reserved keywords used by the internal Language T-SQL –Steve Apr 6 '13 at 23:49 Well I used the start before, but I just added a join with the posts.did and COUNT and now it's messing up. –Hikaru Kagi Apr 6 '13 at 23:52
up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you http://expressionengine.stackexchange.com/questions/23922/error-1096-no-tables-used-codeigniter might have Meta Discuss the workings and policies of this https://github.com/ci-bonfire/Bonfire/issues/839 site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us ExpressionEngine® Answers Questions Tags Users Badges Unanswered Ask Question _ ExpressionEngine® Answers is a question and answer site for administrators, end users, error number developers and designers for ExpressionEngine® CMS. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Error 1096 - No Tables Used - CodeIgniter up vote 0 down vote favorite I am error number 1096 trying to use one of stores hooks to insert data into the database when displaying the success page after paying online for an order and I get the following error: Error Number: 1096 No tables used SELECT * This is the function I am calling on the store_order_complete_end hook from store: public function store_order_complete_end($member_id) { // hook try { // generate coupon code $coupon_code = 'FLK-' . mt_rand(100000000, 999999999); // generate coupon code until code is unique while ($this->check_coupon($coupon_code)) { $coupon_code = 'FLK-' . mt_rand(100000000, 999999999); } //----------------------------------------------------- // -- inserting into table exp_channel_titles -- // retrieving the next available primary key value $entry_id = ee()->db->insert_id(); // array containing the data that will be inserted into the database $titles = array( 'entry_id' => $entry_id, 'site_id' => 1, 'channel_id' => 8, 'author_id' => $member_id, 'ip_address' => null, 'title' => $coupon_code, 'url_title' => strtolower($coupon_code), 'status' => 'open', 'entry_date' => strtotime('now') ); // insert coupon into table exp_channel_titles ee()->db->insert('exp_channel_titles', $titles); //----------------------------------------------------- //----------------------------------------------------- //
Sign in Pricing Blog Support Search GitHub This repository Watch 153 Star 1,351 Fork 547 ci-bonfire/Bonfire Code Issues 96 Pull requests 4 Projects 0 Wiki Pulse Graphs New issue Error Number: 1096 No tables used. Trying to enter admin area after install #839 Closed denis-gorin opened this Issue Jul 2, 2013 · 2 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 2 participants denis-gorin commented Jul 2, 2013 bonfire\modules\settings\models\settings_model.php line 40 protected $table_name = 'settings'; changed to protected $_table = 'settings'; fix the problem denis-gorin commented Jul 2, 2013 wrong approach. better workaround: in application\core\MY_Model.php define protected $table_name = ''; then in constructor $this->_table = $this->table_name; CI Bonfire member mwhitneysdsu commented Jul 2, 2013 Sorry, that one was my fault. I should have MY_Model updated to change the instances of $this->_table to $this->table_name shortly, github for Windows isn't being very cooperative at the moment. mwhitneysdsu added a commit that closed this issue Jul 2, 2013 mwhitneysdsu #839