Jump to content


Photo

Get an SQL error on portal when i change force guest to login


  • Please log in to reply
6 replies to this topic

#1 highlander

highlander

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts

Posted 31 August 2006 - 10:36 PM

When i force guests.. its all fine... but when i don't... I get this error

mySQL query error: SELECT COUNT(DISTINCT(t.tid)) as tcnt,
COUNT(DISTINCT(p.pid)) as pcnt FROM ibf_posts p, ibf_topics t WHERE
p.post_date > AND p.topic_id=t.tid

SQL error: 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 'AND p.topic_id=t.tid' at line 3
SQL error code:
Date: Thursday 31st 2006f August 2006 09:35:32 PM

Any help is really appreciated.

sorry subscribing

#2 eyepuppy

eyepuppy

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 10 November 2006 - 12:39 PM

I know a bunch of you are having this problem

mySQL query error: SELECT COUNT(DISTINCT(t.tid)) as tcnt, 
				COUNT(DISTINCT(p.pid)) as pcnt FROM ibf_posts p, ibf_topics t WHERE 
				p.post_date >  AND p.topic_id=t.tid

SQL error: 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 'AND p.topic_id=t.tid' at line 3
SQL error code: 
Date: Wednesday 08th 2006f November 2006 06:40:28 PM

I have a quick fix. Open your file "sources/action_public/uportal.php" Next, find
//*********************************************/
	//   Welcome Panel 
	//*********************************************/
and scroll down to find the code,
else
			{
				$this->ipsclass->offset_set = 0;
				$data['time'] = $this->ipsclass->get_date(time(), LONG);
				$today = mktime (0,0,0,date("M"),date("D"),date("Y"));

				$query13 = $this->ipsclass->DB->query("SELECT COUNT(DISTINCT(t.tid)) as tcnt, 
				COUNT(DISTINCT(p.pid)) as pcnt FROM ibf_posts p, ibf_topics t WHERE 
				p.post_date > ".$today." AND p.topic_id=t.tid");

				$row = $this->ipsclass->DB->fetch_row($query13);

				$data['topics_since']	= $row[tcnt];
				$data['posts_since']	= $row[pcnt];

				//Replace Stuff

				$this->ipsclass->lang['guestpanel'] = str_replace('<# BOARD URL #>', 
				$this->ipsclass->vars['board_url'], $this->ipsclass->lang['guestpanel']);

				$this->ipsclass->lang['guestpanel'] = str_replace('<# REGISTER #>', 
				$this->ipsclass->lang['register'], $this->ipsclass->lang['guestpanel']);

				$this->ipsclass->lang['guestpanel'] = str_replace('<# OR #>', 
				$this->ipsclass->lang['or'], $this->ipsclass->lang['guestpanel']);

				$this->ipsclass->lang['guestpanel'] = str_replace('<# LOGIN #>', 
				$this->ipsclass->lang['login'], $this->ipsclass->lang['guestpanel']);

				$output .= $this->ipsclass->compiled_templates['skin_uportal']->block_header(
					$this->collapse("welcomepanel"), "guestpanel");

				$output .= $this->ipsclass->compiled_templates['skin_uportal']->guestpanel($data);
				$output .= $this->ipsclass->compiled_templates['skin_uportal']->block_footer();

				return $output;
			}

Now make this block of code look like this
else
{}
This fixed it for me. I'll look into what caused the problem so you can still have the guest welcome panel.

#3 cricket

cricket

    Administrator

  • Root Admin[Root Admin]
  • PipPipPip
  • 308 posts

Posted 10 November 2006 - 02:32 PM

Which version of the portal is this error on?

Posted Image


#4 eyepuppy

eyepuppy

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 10 November 2006 - 03:06 PM

Sorry, I should have said this.

I am running:
- IPB 2.1.7
- Unreal Portal 2.1.0
- MySQL 5.0.24a
- PHP 2.1.7

#5 Gundam

Gundam

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 12 December 2006 - 05:32 AM

I think the problem is in the wrong code inserted...

The error occur because there is no user that is log-in and there is an query happen to get the user status..

The best solution is to delete the bunch of code that cause the error..


Open your sources/action_public/Uportal.php

Find the Code
//*********************************************/
	//   Welcome Panel
	//*********************************************/

then find the code somewhere below it...

else
			{
				$this->ipsclass->offset_set = 0;
				$data['time'] = $this->ipsclass->get_date(time(), LONG);
				$today = mktime (0,0,0,date("M"),date("D"),date("Y"), LONG);

				$query13 = $this->ipsclass->DB->query("SELECT COUNT(DISTINCT(t.tid)) as tcnt,
				COUNT(DISTINCT(p.pid)) as pcnt FROM ibf_posts p, ibf_topics t WHERE
				p.post_date > ".$today." AND p.topic_id=t.tid");

				$row = $this->ipsclass->DB->fetch_row($query13);

				$data['topics_since']	= $row[tcnt];
				$data['posts_since']	= $row[pcnt];

				//Replace Stuff

				$this->ipsclass->lang['guestpanel'] = str_replace('<# BOARD URL #>',
				$this->ipsclass->vars['board_url'], $this->ipsclass->lang['guestpanel']);

				$this->ipsclass->lang['guestpanel'] = str_replace('<# REGISTER #>',
				$this->ipsclass->lang['register'], $this->ipsclass->lang['guestpanel']);

				$this->ipsclass->lang['guestpanel'] = str_replace('<# OR #>',
				$this->ipsclass->lang['or'], $this->ipsclass->lang['guestpanel']);

				$this->ipsclass->lang['guestpanel'] = str_replace('<# LOGIN #>',
				$this->ipsclass->lang['login'], $this->ipsclass->lang['guestpanel']);

				$output .= $this->ipsclass->compiled_templates['skin_uportal']->block_header(
					$this->collapse("welcomepanel"), "guestpanel");

				$output .= $this->ipsclass->compiled_templates['skin_uportal']->guestpanel($data);
				$output .= $this->ipsclass->compiled_templates['skin_uportal']->block_footer();

				return $output;
			}
		}
	}


Delete the following..
$this->ipsclass->offset_set = 0;
				$data['time'] = $this->ipsclass->get_date(time(), LONG);
				$today = mktime (0,0,0,date("M"),date("D"),date("Y"), LONG);

				$query13 = $this->ipsclass->DB->query("SELECT COUNT(DISTINCT(t.tid)) as tcnt,
				COUNT(DISTINCT(p.pid)) as pcnt FROM ibf_posts p, ibf_topics t WHERE
				p.post_date > ".$today." AND p.topic_id=t.tid");

				$row = $this->ipsclass->DB->fetch_row($query13);

				$data['topics_since']	= $row[tcnt];
				$data['posts_since']	= $row[pcnt];

And I'm sure that the problem will not appear again..

#6 eyepuppy

eyepuppy

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 22 February 2007 - 12:38 PM

Ok, I fixed this problem. It seems that this line under the else statement causes problems.
$query13 = $this->ipsclass->DB->query("SELECT COUNT(DISTINCT(t.tid)) as tcnt,
				COUNT(DISTINCT(p.pid)) as pcnt FROM ibf_posts p, ibf_topics t WHERE
				p.post_date > ".$today." AND p.topic_id=t.tid");
When I changed the line to this, it worked fine. Hope this helps someone.
$query13 = $this->ipsclass->DB->query("SELECT COUNT(DISTINCT(t.tid)) as tcnt,
				COUNT(DISTINCT(p.pid)) as pcnt FROM ibf_posts p, ibf_topics t WHERE
				p.post_date > '$today' AND p.topic_id=t.tid");

All I did, was change the part p.post_date > ".$today." AND to p.post_date > '$today' AND

I seems the driver didn't like to closed from the quote then re opened. It shoudn't have caused the problem, but I tried it and it worked. I was just installing 2.1.7 for a friend and he wanted your portal system. I was in the process of removing the code when I saw that and thought I would see if editing it would work. I hope this helps someone.

#7 desireless

desireless

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 17 June 2008 - 02:37 AM

I was having the same problem and after applying what's discussed here (A big thank you!), I got another SQL error.

IPB WARNING [2] Invalid argument supplied for foreach() (Line: 156 of /sources/action_public/uportal.php)


And

mySQL query error: SELECT DISTINCT ibf_posts.author_id, ibf_topics.*,
ibf_forums.name, g.prefix as lprefix, g.suffix as lsuffix, me.mgroup,
gs.prefix as sprefix, gs.suffix as ssuffix, ms.mgroup
FROM ibf_topics, ibf_forums
LEFT JOIN ibf_posts ON (ibf_topics.tid = ibf_posts.topic_id AND
ibf_posts.author_id = '9')
LEFT join ibf_members me on (me.id = ibf_topics.last_poster_id)
LEFT join ibf_groups g on (g.g_id = me.mgroup)
LEFT join ibf_members ms on (ms.id = ibf_topics.starter_id)
LEFT join ibf_groups gs on (gs.g_id = ms.mgroup)
WHERE ibf_topics.forum_id = ibf_forums.id AND
ibf_topics.last_post > 1213665843
ORDER BY last_post DESC

SQL error: Unknown column 'ibf_topics.tid' in 'on clause'
SQL error code:
Date: Tuesday 17th 2008f June 2008 04:31:28 PM



Seems like another user had the same problem unsolved here....
http://www.unreal-solutions.org/index.php?...mp;hl=foreach()

Anyone found solution to this?

Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users