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 8515301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:06:37+00:00 2026-06-11T05:06:37+00:00

Cross posted form the codeigniter forum, where I got crickets. I’ve got a query

  • 0

Cross posted form the codeigniter forum, where I got crickets.

I’ve got a query which I use two left joins and several inner joins, it consistently returns a connection reset error in firefox and no error message in the apache logs.

If I remove the ‘left’ arguments the same error does not occur, if I run the SQL from $this->db->last_query() directly in the DB adding the LEFT joins back in, it comes back properly (either in phpMyAdmin or commandline).

The “inner” arguments don’t need to be passed, I put them in there to experiment.

$this->db->select('votes.uid AS voterUID, comments.uid AS voteeUID, voteTypes.id AS voteTypeID, userratingVoter.level AS voterLevel, userratingVotee.level AS voteeLevel');

$this->db->from('votes');

# Join the comments table on comments.id = votes.cid
$this->db->join('comments', 'comments.id = votes.cid', 'inner');

# Join the userauth table for admin WHERE clause below
$this->db->join('userauth',  'userauth.uid = votes.uid', 'inner');

# Join the votesTypes table for the WHERE IN clause below
$this->db->join('voteTypes', 'voteTypes.id = votes.voteid', 'inner');

# Join the userrating table twice once for the Voter once for the Votee
$this->db->join('userrating AS userratingVotee', 'userratingVotee.uid = comments.uid', 'left');
$this->db->join('userrating AS userratingVoter', 'userratingVoter.uid = votes.uid', 'left');

# Where in valid Vote Types
# Valid Vote Types: helpful, interesting, correct, incorrect
#                   5        4            2        7
$validVoteTypes = array(5,4,2,7);
$this->db->where_in('votes.voteid', $validVoteTypes);

# Where vote is active.
$this->db->where('votes.active',1);

# Where timestamp is greater than the last run timestamp.
$this->db->where('votes.timestamp >',$lastrun);

# Only standard user votes count, may have to update this if we get other authids
$this->db->where('userauth.authid',2);

Broken up SQL from $this->db->last_query()… works in phpMyAdmin and from commandline.

SELECT `votes`.`uid` AS voterUID, `comments`.`uid` AS voteeUID, `voteTypes`.`id` AS voteTypeID, `userratingVoter`.`level` AS voterLevel, `userratingVotee`.`level` AS voteeLevel

FROM (`votes`)

INNER JOIN `comments` ON `comments`.`id` = `votes`.`cid`
INNER JOIN `userauth` ON `userauth`.`uid` = `votes`.`uid`
INNER JOIN `voteTypes` ON `voteTypes`.`id` = `votes`.`voteid`

LEFT JOIN `userrating` AS userratingVotee ON `userratingVotee`.`uid` = `comments`.`uid`
LEFT JOIN `userrating` AS userratingVoter ON `userratingVoter`.`uid` = `votes`.`uid`

WHERE `votes`.`voteid` IN (5, 4, 2, 7)
 AND `votes`.`active` = 1
 AND `votes`.`timestamp` > '2012-03-01 00:00:00'
 AND `userauth`.`authid` = 2

Further if I use a standard query instead of the active record syntax, it produces the same results.

$sql = "SELECT `votes`.`uid` AS voterUID, `comments`.`uid` AS voteeUID, `voteTypes`.`id` AS voteTypeID, `userratingVoter`.`level` AS voterLevel, `userratingVotee`.`level` AS voteeLevel FROM (`votes`) INNER JOIN `comments` ON `comments`.`id` = `votes`.`cid` INNER JOIN `userauth` ON `userauth`.`uid` = `votes`.`uid` INNER JOIN `voteTypes` ON `voteTypes`.`id` = `votes`.`voteid` LEFT JOIN `userrating` AS userratingVotee ON `userratingVotee`.`uid` = `comments`.`uid` LEFT JOIN `userrating` AS userratingVoter ON `userratingVoter`.`uid` = `votes`.`uid` WHERE `votes`.`voteid` IN (5, 4, 2, 7) AND `votes`.`active` = 1 AND `votes`.`timestamp` > '2012-03-01 00:00:00' AND `userauth`.`authid` = 2";

$query = $this->db->query($sql);

If I use a standard JOIN instead of LEFT JOIN for either the error does not occur, though it doesn’t return the data I need.

Server Info:

Apache/2.2.14 (Ubuntu)
PHP/5.3.2
MySQL 5.1.63
CodeIgniter 2.1.2

application/config/database.php

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'some_user';
$db['default']['password'] = 'some_pass';
$db['default']['database'] = 'some_db';
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;  
  • 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-11T05:06:39+00:00Added an answer on June 11, 2026 at 5:06 am

    The reason you are seeing the error in Firefox is presumably because PHP is exiting abnormally for some reason. If you can find the error log on your web server you may be able to see why. EDIT: Just spotted that you’d looked in the error logs already; maybe PHP isn’t set up to log there?

    The most likely cause is that the query is returning so much data that PHP is running out of either memory or processing time trying to process it all. If that is the case, you might want to try using LIMIT and OFFSET clauses in the query to get a “page” of data at a time.

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

Sidebar

Related Questions

I've posted this in the CodeIgniter forum and exhausted the forum search engine as
I've got a basic HTML form from which I can grab a bit of
I posted this question on the Qt forum, but got no answers. That's why
[cross posted again to Mahalo answers] My Perl/Tk script has an initial spreadsheet like
[Cross-posted from lib-curl mailing list] I have a single threaded app (MSVC C++ 2005)
Our company produces cross-platform software and we have Bamboo instance which is building projects
I've created a Cross Origin compatible WCF Service (which took me 4 days of
This is already cross-posted at MS Connect: https://connect.microsoft.com/VisualStudio/feedback/details/560451 I am attempting to override the
I had posted this question on MSDN Forum http://social.msdn.microsoft.com/Forums/en/vsreportcontrols/thread/f00e3406-354d-4f54-acce-7b7f0ad4c90f But I am not getting
I recently asked a question and posted some code, to which a suggestion was

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.