MySQL Near LIMIT1 error. Please help

Topics brought up by the TimeTrex open source community.
Locked
AlexRust2
Posts: 3
Joined: Sun Feb 22, 2009 12:49 pm

MySQL Near LIMIT1 error. Please help

Post by AlexRust2 »

When I click on "Punches" the following errors dispalyed:
PHP Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysqlt error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 12] in EXECUTE("SELECT COUNT(*) FROM punch as a LEFT JOIN punch_control as b ON a.punch_control_id = b.id LEFT JOIN user_date as c ON b.user_date_id = c.id LEFT JOIN users as d ON c.user_id = d.id LEFT JOIN station as e ON a.station_id = e.id LEFT JOIN user_wage as z ON z.id = (select z.id from user_wage as z where z.user_id = c.user_id and z.effective_date <= c.date_stamp and z.deleted = 0 LiMiT 1) WHERE d.company_id = '1' AND (a.deleted = 0 AND b.deleted = 0 AND c.deleted = 0 AND d.deleted = 0) order by time_stamp desc,c.pay_period_id asc,c.user_id asc,a.time_stamp asc,a.punch_control_id asc,a.status_id desc LiMiT 1 LIMIT 1") ' in C:\inetpub\b in C:\inetpub\briggs\intranet35\classes\adodb\adodb-exceptions.inc.php on line 78

When I click on "Scheduled Shifts" :
PHP Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysqlt error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 10] in EXECUTE("SELECT COUNT(*) FROM schedule as a LEFT JOIN user_date as c ON a.user_date_id = c.id LEFT JOIN users as d ON c.user_id = d.id LEFT JOIN user_wage as z ON z.id = (select z.id from user_wage as z where z.user_id = c.user_id and z.effective_date <= c.date_stamp and z.deleted = 0 limit 1) WHERE d.company_id = '1' AND (a.deleted = 0 AND c.deleted = 0 AND d.deleted = 0) order by start_time desc,a.start_time asc,a.status_id asc limit 1 LIMIT 1") ' in C:\inetpub\briggs\intranet35\classes\adodb\adodb-exceptions.inc.php:78 Stack trace: #0 C:\inetpub\briggs\intranet35\classes\adodb\adodb.inc.php(1042): adodb_throw('mysqlt', 'EXECUTE', 1064, 'You have an in C:\inetpub\briggs\intranet35\classes\adodb\adodb-exceptions.inc.php on line 78

I am using
TimeTrex: 2.2.19
MySQL: 5.1.30
PHP: 5.2.8

Please help. It looks like there is a syntax error, possibly here:
function PO_RecordCount($table="", $condition="") {

$lnumrows = $this->_numOfRows;
// the database doesn't support native recordcount, so we do a workaround
if ($lnumrows == -1 && $this->connection) {
IF ($table) {
if ($condition) $condition = " WHERE " . $condition;
$resultrows = $this->connection->Execute("SELECT COUNT(*) FROM $table $condition");
if ($resultrows) $lnumrows = reset($resultrows->fields);
}
}
return $lnumrows;
}
Alex
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

You can try installing the PHP mysqli extension, then in your timetrex.ini.php file change the database from mysqlt to mysqli.
AlexRust2
Posts: 3
Joined: Sun Feb 22, 2009 12:49 pm

Post by AlexRust2 »

Tried this as well. Mysqli extension is enabled and when I try to use it installation shows warning that Innodb is not supported. Any other suggestions? Thanks. Alex
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

I noticed you are running MySQL 5.1.30, which is not officially supported in TimeTrex yet due to it not being a stable release.

I'm not sure if that is the exact cause of the issue you stated, but if you installed TimeTrex without any issues using the mysqlt driver, it should work just changing it to the mysqli driver without reinstalling.

These issues and many others are the reasons why we recommend using PostgreSQL if at all possible instead.
AlexRust2
Posts: 3
Joined: Sun Feb 22, 2009 12:49 pm

Post by AlexRust2 »

Wow, it works. Thanks.
Just a suggestion - Can you please be more specific in the System Requirements so we can see what is working and what is not tested or not supported before we start installation. That can save a lot of time for many people.
Regards,
Alex
Locked