Jump to content
  • 0
Sign in to follow this  
TENAZ

Wyciągnięcie danych z innej bazy danych, niż ta co jest pod forum.

Question

Witam,

Jak wyciągnąć dane z innej bazy danych, niż ta co jest pod forum w szablonie?

 

Z góry dzięki.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
public function acpForm()
	{
		return array(
			'login_external_conn',
			'sql_host'		=>  new \IPS\Helpers\Form\Text( 'login_external_host', $this->settings['sql_host'] ?: 'localhost', TRUE ),
			'sql_user'		=>  new \IPS\Helpers\Form\Text( 'login_external_user', $this->settings['sql_user'], TRUE ),
			'sql_pass'		=>  new \IPS\Helpers\Form\Text( 'login_external_pass', $this->settings['sql_pass'], TRUE ),
			'sql_database'	=>  new \IPS\Helpers\Form\Text( 'login_external_database', $this->settings['sql_database'], TRUE ),
			'sql_port'		=>  new \IPS\Helpers\Form\Number( 'login_external_port', $this->settings['sql_port'], FALSE ),
			'sql_socket'	=>  new \IPS\Helpers\Form\Text( 'login_external_socket', $this->settings['sql_socket'], FALSE ),
			'login_external_schema',
			'db_table'		=>  new \IPS\Helpers\Form\Text( 'login_external_table', $this->settings['db_table'], TRUE ),
			'db_col_user'	=>  new \IPS\Helpers\Form\Text( 'login_external_username', $this->settings['db_col_user'], FALSE, array(), function( $val )
					{
						if ( !$val and \IPS\Request::i()->login_auth_types & \IPS\Login::AUTH_TYPE_USERNAME )
						{
							throw new \DomainException('login_external_username_err');
						}
					} ),
			'db_col_email'	=>  new \IPS\Helpers\Form\Text( 'login_external_email', $this->settings['db_col_email'], FALSE, array(), function( $val )
					{
						if ( !$val and \IPS\Request::i()->login_auth_types & \IPS\Login::AUTH_TYPE_EMAIL )
						{
							throw new \DomainException('login_external_email_err');
						}
					} ),
			'db_col_pass'	=>  new \IPS\Helpers\Form\Text( 'login_external_password', $this->settings['db_col_pass'], TRUE ),
			'db_encryption'	=>  new \IPS\Helpers\Form\Select( 'login_external_encryption', $this->settings['db_encryption'], TRUE, array( 'options' => array(
						'md5'		=> 'MD5',
						'sha1'		=> 'SHA1',
						'plaintext'	=> 'login_external_encryption_plain',
					) ) ),
			'db_extra'		=>  new \IPS\Helpers\Form\Text( 'login_external_extra', isset( $this->settings['db_extra'] ) ? $this->settings['db_extra'] : '' ),
			'login_settings',
			'auth_types'	=> new \IPS\Helpers\Form\Select( 'login_auth_types', $this->settings['auth_types'], TRUE, array( 'options' => array(
				\IPS\Login::AUTH_TYPE_USERNAME => 'username',
				\IPS\Login::AUTH_TYPE_EMAIL	=> 'email_address',
				\IPS\Login::AUTH_TYPE_USERNAME + \IPS\Login::AUTH_TYPE_EMAIL => 'username_or_email',
			) ) ),
		);
	}
	

Tutaj masz wzór z logowania z innej bazy.

Share this post


Link to post
Share on other sites
  • 0
public function acpForm()
	{
		return array(
			'sql_host'		=>  new \IPS\Helpers\Form\Text( 'test_host', $this->settings['sql_host'] ?: 'localhost', TRUE ),
			'sql_user'		=>  new \IPS\Helpers\Form\Text( 'test_user', $this->settings['sql_user'] ?: 'test', TRUE ),
			'sql_pass'		=>  new \IPS\Helpers\Form\Text( 'test_pass', $this->settings['sql_pass'] ?: 'test', TRUE ),
			'sql_database'	=>  new \IPS\Helpers\Form\Text( 'test_database', $this->settings['sql_database'] ?: 'test', TRUE ),
			'db_table'		=>  new \IPS\Helpers\Form\Text( 'test_table', $this->settings['db_table'] ?: 'test', TRUE ),
		);
	}

Coś takiego?

Edited by TENAZ

Share this post


Link to post
Share on other sites
  • 0

A jak już takie mam to wyciągnięcie danych z bazy to poprzez IPS\db:: czy normalnie $sql = 'query...'?

Share this post


Link to post
Share on other sites
  • 0

Wszystko masz w pliku do logowania z zewnętrznej bazy danych. Wystarczy się tym plikiem kierowac.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

W celu świadczenie usług przez nasz Serwis na najwyższym poziomie, w ramach Serwisu wykorzystujemy pliki Cookies (tzw. ciasteczka). Korzystając ze stron Serwisu IPSBEYOND.PL bez zmiany ustawień przeglądarki będą one zapisane w pamięci urządzenia. Jeżeli nie dokonacie Państwo zmiany ustawień przeglądarki internetowej to wyrażacie zgodę na zapisywanie plików Cookies.