[FIXED] - Poll Topic Error !!!

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
User avatar
vrflyer
Registered User
Posts: 503
Joined: Mon Feb 17, 2003 8:27 pm

[FIXED] - Poll Topic Error !!!

Post by vrflyer »

If logged-in no error, but if viewed as "guest" it blows up ? :? (v2.0.4 & No Mods. New Poll)

General Error:

Could not obtain user vote data for this topic

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near '' at line 4

SELECT vote_id FROM phpbb_vote_voters WHERE vote_id = 3 AND vote_user_id =

Line : 699
File : /home/cbushon/public_html/forum/viewtopic.php


.
Last edited by vrflyer on Mon Mar 17, 2003 7:38 pm, edited 1 time in total.
Always Under Construction !
User avatar
vrflyer
Registered User
Posts: 503
Joined: Mon Feb 17, 2003 8:27 pm

Post by vrflyer »

Please help..

I've searched the entire sit and among others as well.... with no luck ... :roll:
Always Under Construction !
User avatar
vrflyer
Registered User
Posts: 503
Joined: Mon Feb 17, 2003 8:27 pm

Post by vrflyer »

vrflyer wrote: Please help..

I've searched the entire sit and among others as well.... with no luck ... :roll:


Well problem fixed !!!!

Co-Worker helped me out by modifying the "viewtopic.php" file and fixed GUEST Error when viewing Topics w/POLLS.
FROM THIS (Line 669 for ref.):

// Does this topic contain a poll?
//
if ( !empty($forum_topic_data['topic_vote']) )
{
$s_hidden_fields = '';

$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain vote data for this topic", '', __LINE__, __FILE__, $sql);
}

if ( $vote_info = $db->sql_fetchrowset($result) )
{
$db->sql_freeresult($result);
$vote_options = count($vote_info);

$vote_id = $vote_info[0]['vote_id'];
$vote_title = $vote_info[0]['vote_text'];

if ( empty($userdata['user_id']) )
{
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain user vote data for this topic", '', __LINE__, __FILE__, $sql);
}


TO THIS:

// Does this topic contain a poll?
//
if ( !empty($forum_topic_data['topic_vote']) )
{
$s_hidden_fields = '';

$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain vote data for this topic", '', __LINE__, __FILE__, $sql);
}

if ( $vote_info = $db->sql_fetchrowset($result) )
{
$db->sql_freeresult($result);
$vote_options = count($vote_info);

$vote_id = $vote_info[0]['vote_id'];
$vote_title = $vote_info[0]['vote_text'];

if ( empty($userdata['user_id']) )
{
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = -1";
}
else

{
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain user vote data for this topic", '', __LINE__, __FILE__, $sql);
}


I hope this helps someone in the future ... :wink:
Always Under Construction !
User avatar
vrflyer
Registered User
Posts: 503
Joined: Mon Feb 17, 2003 8:27 pm

Post by vrflyer »

TTT ...... for anyone having this problem .... :twisted:
Always Under Construction !
Locked

Return to “2.0.x Support Forum”