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

  • SEARCH
  • Home
  • 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 8071227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:38:58+00:00 2026-06-05T13:38:58+00:00

For some reason I am getting the number or rows and not the results

  • 0

For some reason I am getting the number or rows and not the results I need.

$sql = "SELECT t1.*,
u.id,
u.username, 
p.profile_picture 
FROM messages t1
JOIN (SELECT from_id, MAX(date) date FROM messages GROUP BY from_id) t2
ON t1.from_id = t2.from_id AND t1.date = t2.date
LEFT JOIN
users u
ON
u.id = t1.from_id
LEFT JOIN
profiles p
ON
p.user_id = t1.from_id
";

$query = DB::query(‘Database::SELECT’,$sql);

$messages = $query->execute();

echo Kohana::debug($messages); // for some reason getting number of rows here

The documentation says

Specifying the type changes the returned result. When using
Database::SELECT, a Database_Query_Result will be returned.
Database::INSERT queries will return the insert id and number of rows.
For all other queries, the number of affected rows is returned.

What am I doing wrong?

  • 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-05T13:38:58+00:00Added an answer on June 5, 2026 at 1:38 pm

    You need to use $query = DB::query(Database::SELECT,$sql);.

    Notice the lack of quotes. You need to use the constant value.

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

Sidebar

Related Questions

For some reason I'm getting more results than I expected since the upgrade to
I'm using PDO and MySQL, for some reason when getting values from the database
For some reason I’m getting an undefined variable on the view and not quite
For some reason I'm not getting the expected output on this curl function, IF
For some reason I was getting a dramatically incorrect answer for a problem, so
For some reason i'm getting an unexpected [ in the below line of code.
For some reason I am getting the error No database selected I have no
I'm writing a program in C++ and for some reason I'm getting a segmentation
I have just tried using the NSArchiver but for some reason I am getting
I have this header file ... for some reason I keep getting an error

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.