Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8834995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:09:25+00:00 2026-06-14T09:09:25+00:00

I have a sql command , it is work but I can’t using it

  • 0

I have a sql command , it is work but I can’t using it in Codeigniter ,

when I use it in phpmyadmin it is works

SELECT online_visitors.page_id , hotels.hotel_name ,
count(online_visitors.page_id) as count_visit FROM online_visitors ,
hotels WHERE online_visitors.page_type = ‘hotel’ AND
online_visitors.is_bot = 0 AND hotels.ID = online_visitors.page_id
group by online_visitors.page_id order by online_visitors.page_id asc

but when I want to useing it in codeigniter code I can’t

$this->db->select("page_id , hotel_name");
$this->db->from("hotels");
$this->db->join("online_visitors");
$this->db->where("is_bot", 0);
$this->db->where("page_type", 'hotel');
$this->db->group_by("page_id");
$this->db->order_by("page_id");
$this->db->get();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:09:27+00:00Added an answer on June 14, 2026 at 9:09 am

    You can do this by 2 methods as mentioned

    $query=$this->db->query(
    'SELECT online_visitors.page_id , hotels.hotel_name , count(online_visitors.page_id) as count_visit FROM online_visitors , hotels WHERE online_visitors.page_type = 'hotel' AND online_visitors.is_bot = 0 AND hotels.ID = online_visitors.page_id group by online_visitors.page_id order by online_visitors.page_id asc'
    );
    

    and you can access $query as object

    or you can break it down using Active Record

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query in Delphi using DBExpress TSQLQuery that looks like so ActiveSQL.sql.add('SELECT
We are planning on using Red Gate SQL Source Control , but have not
I have the following SQL command that I need to save as a csv
I most likely have a syntax issue (SQL command and error copied below) -
I have this query which on executing in my sql command line client executes
I'm having a problem in a SQL command. I have a table with questions,
I have a class I use to split a string of SQL commands by
I have the code below: using (SqlCommand command = new SqlCommand()) { command.CommandType =
I have tried looking in other areas, but I can't seem to figure out
So, how can I drop all indexes in a SQL database with one command?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.