News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Defining & Showing My Own Variable

Started by thall89553, July 19, 2006, 02:55:19 AM

Previous topic - Next topic

thall89553

In an earlier post I asked about making a 2nd db connection in my forum. I have been able to do so and even got it to echo a value from that 2nd database. The issue I am having is this. At the end of the index.php page code I inserted this:

if (empty($db_persist))
$db2_connection = @mysql_connect($db_server, $db2_user, $db2_passwd);
else
$db2_connection = @mysql_pconnect($db_server, $db2_user, $db2_passwd);
if (!$db2_connection || !@mysql_select_db($db2_name, $db2_connection))
db_fatal_error();

$sql_row = mysql_fetch_array(db2_query("SELECT * from Directory", __FILE__, __LINE__));
echo  $sql_row[shop];

If you look at the page www.1stautorepair.com/forum/index.php at the very bottom you will see the value of $sql_row[shop]  (you have to do a ctrl-a as it is black text on black bg). Ok, so how do I get that value (and others) up to the top of the page and populate such information as telephone, address, etc. Thanks so much.

Elmacik

You should NOT use any echo in index.php
To print your variables in the main page, you should edit your index.template.php
For example in /Themes/default/index.template.php if you put your codes under the <body> tag, it will display at the top of your page.
Home of Elmacik

Advertisement: