TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:30:06 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 174
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 167
  • Total: 167

Adding database info

Started by RebelRose, June 05, 2007, 12:08:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rebelrose

Is it possible to put information from a database that is not on the same site into a block?

IchBin

If you're calling data directly from the database it has to be configure to allow the connection from the place that you're calling it from. MySQL DB's are configured by default to only allow connections from inside the same machine.
Other ways you can do it is to have a cronjob export your data to a file at certain times of the day. Then you can have a script pickup the info in that file and do what you need with it.

rebelrose

Thank You IchBinâ„¢  :)

Nikki Sixx

#3
I suppose this scenario would work:

You must be granted a MySQL user account with the privilege "SELECT" (or "ALL") from the SMF database where the block is you want to copy. Your Web server's hostname or IP address must also be permitted to access the MySQL database where that SMF database is housed. You can use this PHP script-

<?php

mysql_connect
("your-servers-hostname/IP""your-given-username""your-given-password") or die(mysql_error());

mysql_select_db("their-SMF-database") or die(mysql_error());

$sql 'SELECT * FROM 'smf_tp_blocks' WHERE ( ('smf_tp_blocks' . 'id' = ?? ) ) ';

?>


and where "??" (no surrounding quotes in query) would be the numerical value of the block you wish to copy from their table/database.

In PHPMyAdmin or whatever you like, create a new row in the "smf_tp_blocks" table of your database and enter the same numerical value in the "id" field (both must match). Another PHP script (which I can not write :P) can then import the row's field values you got from the above script which dynamically gathered the block from the other SMF forum you wanted.