phpScheduleIt
May 18, 2013, 05:38:37 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Viewing/Modifying./Deleting a reservation  (Read 6604 times)
jwh
Newbie
*

Karma: 0
Posts: 7


« on: December 19, 2006, 05:36:43 PM »

PHP version: 4.3.2

Database server and version: MySQL 3.23.58

Web server and version: Apache 2.0

Browser vendor and version: Mozilla Firefox 2.0 and Microsoft Internet Explorer 7.0

Description of bug: Received error “There was an error executing your query:
DB Error: syntax error”

What you were doing at the time of the bug: Attempting to select and modify/delete an already existing reservation (while logged in as Administrator)

Any help would be greatly appreciated…

JWH
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #1 on: December 21, 2006, 12:30:39 PM »

This is because MySQL 3.x isn't fully supported by phpScheduleIt.

If you can, let's try some debugging steps to identify where the problem is.  First, try commenting out lines 507-527 in lib/db/ResDB.class.php and see if you still see the issue.

Example

Code:
// $sql = 'SELECT ru.*, users.fname, users.lname, users.email FROM '
// . $this->get_table(TBL_RESERVATION_USERS) . ' as ru INNER JOIN ' . $this->get_table(TBL_LOGIN) . ' as users'
// . ' ON users.memberid = ru.memberid WHERE ru.resid=?'
// . ' UNION SELECT ru.*, au.fname, au.lname, au.email FROM '
// . $this->get_table(TBL_RESERVATION_USERS) . ' as ru INNER JOIN ' . $this->get_table(TBL_ANONYMOUS_USERS) . ' as au'
// . ' ON ru.memberid = au.memberid WHERE ru.resid=?';
//
// $result = $this->db->query($sql, array($resid, $resid));
//
// $this->check_for_error($result);
//
// if ($result->numRows() <= 0) {
// $this->err_msg = translate('That record could not be found.');
// return false;
// }
//
// while ($rs = $result->fetchRow()) {
// $return[] = $rs;
// }
//
// $result->free();
Logged
jwh
Newbie
*

Karma: 0
Posts: 7


« Reply #2 on: December 21, 2006, 02:58:22 PM »

When I comment out the lines, there is no error message or info - all it shows is the empty table (background?). I have tried editing the code elsewhere to make it work with MySQL 3.x (like changing "LEFT JOIN"s to "INNER JOIN"s or just using a long "WHERE" statement), but I still can't get it to run properly. I'm going to try finding another server and database that will be more compatible. As a last effort today, we tried PHP 3.x to a 5.x MySQL database, but PHP couldn't connect properly - too much of a version difference.

I DO really want to use the program, though - it's exactly what we need if I can get it up and running! If you have any other suggestions, I'd really appreciate them, but it might be easier at this point to just beg my way onto another server; that will just take a few months.

Thanks for your help! And great program!

JWH
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #3 on: December 23, 2006, 03:40:50 AM »

If the error is gone when commenting out those lines, try changing that whole section (507-527) to this:

Code:
$sql = 'SELECT ru.*, users.fname, users.lname, users.email FROM '
. $this->get_table(TBL_RESERVATION_USERS) . ' as ru INNER JOIN ' . $this->get_table(TBL_LOGIN) . ' as users'
. ' ON users.memberid = ru.memberid WHERE ru.resid=?';

$result = $this->db->query($sql, array($resid));

$this->check_for_error($result);

if ($result->numRows() <= 0) {
$this->err_msg = translate('That record could not be found.');
return false;
}

while ($rs = $result->fetchRow()) {
$return[] = $rs;
}

$sql = 'SELECT ru.*, au.fname, au.lname, au.email FROM '
. $this->get_table(TBL_RESERVATION_USERS) . ' as ru INNER JOIN ' . $this->get_table(TBL_ANONYMOUS_USERS) . ' as au'
. ' ON ru.memberid = au.memberid WHERE ru.resid=?';

$result = $this->db->query($sql, array($resid));

$this->check_for_error($result);

if ($result->numRows() <= 0) {
$this->err_msg = translate('That record could not be found.');
return false;
}

while ($rs = $result->fetchRow()) {
$return[] = $rs;
}

$result->free();


This code just breaks up the UNION sql statement into 2 queries.  If the problem was with the UNION statement, then you should be all set after this change.
Logged
jwh
Newbie
*

Karma: 0
Posts: 7


« Reply #4 on: December 24, 2006, 12:39:36 AM »

That didn't work, either. However, when I changed lines 97 to 116 to the new code (see below), I got the error message "That record could not be found." I tried replacing this code because it was the only other part in the page that seemed to refer to retrieving information about a reservation.

Code:


$query = 'SELECT r.*, ru.memberid AS participantid, rem.reminder_time, rem.reminderid FROM ' . $this->get_table(TBL_RESERVATIONS) . ' r'

. ' LEFT JOIN ' . $this->get_table(TBL_RESERVATION_USERS) . ' ru ON r.resid = ru.resid AND ru.memberid = ? AND ru.owner = 0 AND ru.invited = 0'

. ' LEFT JOIN ' . $this->get_table(TBL_REMINDERS) . ' rem ON r.resid = rem.resid AND rem.memberid = ?'

. ' WHERE r.resid=?';

$result = $this->db->getRow($query, array($memberid, $memberid, $resid));

$this->check_for_error($result);

if (count($result) <= 0) {

$this->err_msg = translate('That record could not be found.');

return false;
}
return $this->cleanRow($result);



I've also noticed that my line numbers are very different from the ones you have given and I've seen elsewhere on this forum. I doubt that has anything to do with it, but if I refer to line numbers I'll include little snippets of code as a reference.

Thanks for the help so far!

JWH
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #5 on: December 26, 2006, 11:59:47 AM »

What version of phpScheduleIt is this?
Logged
jwh
Newbie
*

Karma: 0
Posts: 7


« Reply #6 on: December 27, 2006, 08:05:17 PM »

Quote from: "Nick"
What version of phpScheduleIt is this?


phpScheduleIt v1.2.5

It was downloaded and installed about a week ago.

JWH
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #7 on: December 30, 2006, 03:21:20 PM »

For some reason we seem to be looking at different line numbers in this file.  The change I was referring to would be in the get_res_users() function of lib/db/resdb.class.php.
Logged
jwh
Newbie
*

Karma: 0
Posts: 7


« Reply #8 on: December 30, 2006, 04:59:53 PM »

Quote from: "Nick"
For some reason we seem to be looking at different line numbers in this file.  The change I was referring to would be in the get_res_users() function of lib/db/resdb.class.php.


That was the section that I originally changed; all I get is a blank page (I tried it again just to be sure). I also tried changing the "LEFT JOIN"s in get_reservation($resid, $memberid) to "INNER JOIN"; then I got the error message, "That record could not be found."

The only trouble shooting I have done has been in get_reservation($resid, $memberid) and get_res_users($resid), but the closest I've gotten is recieving the message "That record could not be found."

JWH
Logged
jwh
Newbie
*

Karma: 0
Posts: 7


« Reply #9 on: December 31, 2006, 07:56:24 PM »

Is there a previous version of phpScheduleIt that would work with MySQL 3.x? I wouldn't mind using an older version for a few months until I can find appropriate server space.

Thanks so much for your help!

JWH
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #10 on: January 02, 2007, 09:34:59 AM »

My guess is that the latest 1.1 package should work fine.  I believe this issue was introduced with some of the advanced features of 1.2.
Logged
jwh
Newbie
*

Karma: 0
Posts: 7


« Reply #11 on: January 02, 2007, 06:39:14 PM »

Quote from: "Nick"
My guess is that the latest 1.1 package should work fine.  I believe this issue was introduced with some of the advanced features of 1.2.


I installed version 1.1.3 today, and so far it is working well. I'll be using that until our campus servers are updated in the summer.

Thanks so much for your help! And wonderful program!

JWH
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #12 on: January 03, 2007, 09:47:32 AM »

I'll be posting any future updates to this problem in the forums.  I'm sure there is a workaround for this.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!