Pagina 1 van 1

Foutmelding ListUsers OPGELOST

Geplaatst: 21 mei 2005, 19:51
door Muiter
Ik krijg deze foutmelding:
SELECT username FROM modelautoforum_nl_-_forum.phpbb_users WHERE user_active = '1' ORDER BY username ASC

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near '-_forum.phpbb_users WHERE user_active = '1' ORDER BY username ASC ' at line 3

SELECT username FROM modelautoforum_nl_-_forum.phpbb_users WHERE user_active = '1' ORDER BY username ASC

Line : 52
File : list_usernames.php
list_usernames.php

Code: Selecteer alles

<?php
   define('IN_PHPBB', true);
   $phpbb_root_path = './';
   include($phpbb_root_path . 'extension.inc');
   include($phpbb_root_path . 'common.'.$phpEx);


	$server_list = $_SERVER['PHP_SELF'];
	$db_table = $table_prefix . 'users';
	$list_username = $users->username;
					
	//
	// Start session management
	//
	$userdata = session_pagestart($user_ip, PAGE_INDEX);
	init_userprefs($userdata);
	//
	// End session management
	//

	$gen_simple_header = TRUE;

	if(!isset($userdata['session_logged_in'])) {
	   @header("Location: " . append_sid($phpbb_web_path . "login." . $phpEx . "?redirect=" . $_SERVER['PHP_SELF']));
	}

	$page_title = $lang['Page_Title'];
	@include("includes/page_header.$phpEx");

	$template->set_filenames(array(
		'Body' => 'list_usernames.tpl'
	));

	$template->assign_vars(array(
		'L_HEADER' => 'Select a Username',
		'L_COPY' => '&copy; 2003, <a href="http://www.digiserv.net/" target="_blank">digiServ Network</a>.',
		'L_PCV_COPY' => 'Released via <a href="http://www.pcvillageforums.com/" target="_blank">PC Village Forums</a>.<br />
						Get support and more mods <a href="http://www.pcvillageforums.com/" target="_blank">here</a>.',
		'U_FORM_ACTION' => $_SERVER['PHP_SELF']
	));

	$db_table = $table_prefix . 'users';
	$sql = "
		SELECT	username
		FROM	$db->dbname.$db_table
		WHERE	user_active = '1'
		ORDER	BY username
				ASC
	";

	if (!$result = $db->sql_query($sql)) {
		message_die(GENERAL_ERROR, $sql, 'Error Querying Database', __LINE__, __FILE__, $sql);
	}

	if ($row = $db->sql_fetchrow($result)) {
		$i = 0;

		do {
			$template->assign_block_vars('user_block', array(
				'L_USERNAME' => $row['username']
			));

			$i++;
		}
		while ($row = $db->sql_fetchrow($result));
	}

	$db->sql_freeresult($result);
	$template->pparse('Body');
	@include("includes/page_tail.$phpEx");
?>

Geplaatst: 21 mei 2005, 19:57
door -=|Rik|=-
Wat is de naam van je database?

Geplaatst: 21 mei 2005, 19:59
door Bee

Code: Selecteer alles

      FROM   $db->dbname.$db_table
wordt

Code: Selecteer alles

      FROM   $db_table
Maar echt goed gebruik maken van de constants is dit niet

Geplaatst: 21 mei 2005, 21:02
door Muiter
bee schreef:

Code: Selecteer alles

      FROM   $db->dbname.$db_table
wordt

Code: Selecteer alles

      FROM   $db_table
Maar echt goed gebruik maken van de constants is dit niet
Het werkt, wat is wel de juiste manier?

Geplaatst: 21 mei 2005, 22:49
door Bee
eigenlijk moet er gebruikt worden gemaakt van USERS_TABLE