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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 110
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 74
  • Total: 74

DB Connection Error

Started by Thalov, August 15, 2007, 02:30:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thalov

I've written some other php scripts for SMF/TP and they function fine. However for some reason when I did my latest coding when I insert the line of code for connecting to the DB - SMF/TP fails to display anything. What am I doing wrong/what could be causing this?

<link href="http://www.nflcoolertalk.com/USS_Ethos/BioTools/css/bio.css" rel="stylesheet" type="text/css" media="screen" />
<?php
//Initialize and connect to the DB
include('http://www.nflcoolertalk.com/USS_Ethos/SSI.php');
include(
'http://www.nflcoolertalk.com/USS_Ethos/BioTools/account.php');
$user_id $context[user][id];
$table_bio "bio";

$connection = @mysql_connect('$db_host''$db_name''$db_pw') or die(mysql_error());
//$db = @mysql_select_db($db_name, $connection) or die(mysql_error());

//$sql_bio = "SELECT * FROM $table_bio WHERE user = $user_id";
//$result_bio = @mysql_query($sql_bio, $connection) or die(mysql_error());
//$bio = mysql_fetch_array($result_bio);

// Display the various layers
echo "
<div id=\"main\">

<div id=\"header\">
<div id=\"rank\">
$bio[rank]</div>
<div id=\"job2\">
$bio[job2]</div>
<div id=\"name\"><b>
$bio[name]</b></div>
<div id=\"job1\"><b>
$bio[job1]</b></div>
</div>
<div id=\"pic\"></div>
<div id=\"service\">
<div id=\"scontent\">
$bio[service]</div>
</div>
<div id=\"vitals\">
<div id=\"vcontent\">Gender: 
$bio[sex]<br>Species: $bio[species]<br>Height: $bio[h_ft]ft $bio[h_in]in<br>Weight: $bio[weight]lbs<br>Age: $bio[age] years</div>
</div>
<div id=\"medical\">
<div id=\"mcontent\">
$bio[medhistory]</div>
</div>
<div id=\"awards\">
<div id=\"acontent\">
$awards</div>
</div>
<div id=\"backstory\">
<div id=\"bcontent\">
$bio[reveal_background]</div>
</div>
<div id=\"skills\">
<div id=\"skcontent\">
$bio[skills]</div>
</div>
<div id=\"family\">
<div id=\"fcontent\">
$bio[family]</div>
</div>

</div>"
;
?>

IchBin

I think there is no need to surround your connection variables with quotes as that is treating them like strings.

Crip

no need for the direct url path, shorter the better.
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Thalov

Yeah - I had originally done it with shorter relative paths and no quotes around the variables. Forgot to change that back when I posted it here.

Thalov

Weird - it magically works. Guess it was just a syntax error somewhere.

Crip

I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



This website is proudly hosted on Crocweb Cloud Website Hosting.