I can't seem to get a website link to display on a profile page without generating error messages. I used the code pasted below in a php block - modified a bit from something okweb posted, and it does work - i.e. it makes a working link on the profile page, but it generates the following errors:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'caltrade'@'localhost' (using password: NO) in /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolDb.php on line 508
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolDb.php on line 508
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolDb.php:508) in /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/design.inc.php on line 133
Strange thing is, I did this late in the evening and it worked fine - I checked on several profiles and it was working - but the next morning those errors appeared, and they have been there ever since when I move that block back. Can anyone figure out what is going on? The code I used is below if any gurus could take a look.
Rob
$profileID = getID( $_REQUEST['ID'] );
$my_dbHost="localhost";
$my_dbLogin="caltrade";
$my_dbPass="password7";
$my_db="caltrade7";
$connection=mysql_connect("$my_dbHost","$my_dbLogin","$my_dbPass") or die("Couldn't connect to the server.");
$db=mysql_select_db("$my_db", $connection) or die("Couldn't select a database.");
$sql="SELECT * FROM Profiles WHERE ID='$profileID'";
$sql_result=mysql_query($sql,$connection) or die("Couldn't execute query!");
$res=mysql_fetch_array($sql_result);
$Website=$res["Website"];
echo "<div class=\"boxContent\">";
echo "<table class=\"profile_info_block\" cellspacing=0 cellpadding=1>";
if( strlen($Website) > 0 )
{
echo "<tr><td class=\"profile_info_label\"><br />Link: </td>
<td class=\"profile_info_value\" ><br />
<a href=\"http://$Website\" target=\"_blank\"><b>$Website</b></a>
</td></tr>";
}
if(strlen($Website) < 1)
{
echo "<tr><td class=\"profile_info_label\"></td><td class=\"profile_info_value\" ><b>No website link yet</b></td></tr>";
}
echo "</table>";
echo "</div>";
mysql_close($connection);