Welcome to Geeklog, Anonymous Tuesday, April 23 2024 @ 12:04 pm EDT

Geeklog Forums

journal SQL error - users unable to edit previous posts


Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
as site admin, i am able to edit any and all journal entries, however, users that own their journals see a white screen that reads "SQL error - please see error.log for details". In error.log, I see the following:
Text Formatted Code
Tue May 18 03:42:39 2004 - 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 '' at line 1. SQL in question: SELECT jrn_uid FROM gl_journal WHERE jrn_id =
 


Anybody have a suggestion on how this could be fixed?
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
*thinking out loud*
from what I can see, since the url the user is going /journal/index.php?mode=edit&type=entry&je_id=20040518032829627
sooo, since type=entry, thats true... so we go over to shownavigation and then editjournalentry($je_id). from what i understand, $je_id would = 20040518032829627 if we use the url above.
Text Formatted Code
case 'edit':
        if ($type == 'entry') {
            $display .= shownavigation($mode,$cur_journal);
            $display .= editjournalentry($je_id);
 


over to editjournalentry in functions.inc, the first few lines...
Text Formatted Code
 if( ownsjournal( $jrn_id ) )
 

soo, that would call ownsjournal ( $jrn_id ), right? But how does it know what $jrn_id is, it wasn't passed in the previous call or in the URL? anyways...
Text Formatted Code

 $result = DB_query("SELECT jrn_uid FROM {$_TABLES['journal']} WHERE jrn_id = $jrn_id");
              $A = DB_fetchArray($result);
              if( $_USER["uid"] == $A["jrn_uid"] )

 

sooo, not knowing how $jrn_id gets here. from the SQL error in my previous post its almost like it doesn't? help? please
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

craig

Anonymous
can you throw in a "print $jrn_id;" and see what you get?
it;s either null, of contains a single quote
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
Quote by craig: can you throw in a "print $jrn_id;" and see what you get?
it;s either null, of contains a single quote

it contains the proper jrn_id, which is frustrating me even more.

Can nobody else help me with this?
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

Status: offline

destr0yr

Forum User
Full Member
Registered: 07/06/02
Posts: 324
hmm
thats wack. i fixed it...

in /path/to/geeklog/plugins/journal/functions.inc, i changed the following (~ line 736) from:
Text Formatted Code

$result = DB_query("SELECT jrn_uid FROM {$_TABLES['journal']} WHERE jrn_id = $jrn_id");

 

to
Text Formatted Code
$result = DB_query("SELECT jrn_uid FROM {$_TABLES['journal']} WHERE jrn_uid = {$_USER['uid']}");
 

i just hope it doesn't negatively effect anything else.
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
 Quote

All times are EDT. The time is now 12:04 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content