Sorry doesn't work for me. I have tried for 1? hour now:
Now I get this error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in [path]/modules/blog_comments_cars.php on line 31
I cannot connect to the database
I am 100% sure the password is correct - as I use it with success with e.g. your default version. This is the code I use with your changes:
PHP Code:
<?php
// I spent a while on this please leave the next couple of lines intact
// Coded by Optrex @ www.midlandsweather.org.uk
// Please do not put this onto any other site for download unless permision
has been granted by myself (Optrex)
// This script is copyright www.midlandsweather.org.uk
//variables to change below
$database = database; //replace xxx with the name of your
database$username = username; //replace xxx with your database
username$password = password; //replace xxx with your database
password$wordcount = 50; //replace 50 with the number of words you want to
have in your comments until cut off with ....
$website = "http://xxx.com/forum/blog.php"; //full website URL to your
blog .php file including http
$prefix = forum; //table prefix - IF YOU DONT HAVE ONE USE '' INSTEAD OF vb
$category = 16; //where x is the category id number found in your AdminCP
$limit = 5; //replace 5 with the umber of comments you want to show
//end of variables
function shorten_string($string, $wordsreturned)
{
$retval = $string; // Just in case of a problem
$array = explode(" ", $string);
if (count($array)<=$wordsreturned)
{
$retval = $string;
}
else
{
array_splice($array, $wordsreturned);
$retval = implode(" ", $array)."....read more";
}
return $retval;
}
$link = mysql_connect ("localhost", "{$username}", "{$password}") or die("I
cannot connect to the database");
mysql_select_db ("{$database}");
$query = "SELECT {$prefix}blog.blogid, {$prefix}blog.categories,
{$prefix}blog_text.title, {$prefix}blog_text.blogtextid,
{$prefix}blog_text.userid, {$prefix}blog_text.username,
{$prefix}blog_text.state, {$prefix}blog_text.pagetext, {$prefix}blog.title AS
title2 ".
"FROM {$prefix}blog, {$prefix}blog_text ".
"WHERE {$prefix}blog.blogid = {$prefix}blog_text.blogid AND
{$prefix}blog_text.title = '' AND {$prefix}blog_text.state = 'visible' AND
{$prefix}blog.categories = '{$category}'
ORDER BY {$prefix}blog_text.dateline desc
LIMIT {$limit}";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$longcomment= shorten_string($row['pagetext'],$wordcount);
$comment= $bbcode_parser->do_parse($longcomment, 1,1,1,1);
echo "<tr><td class=\"$bgclass\" align=\"left\"><span
class=\"{$Style['small']}\"><a
href=\"{$website}/member.php?u={$row['userid']}\">{$row['username']}</a>";
echo " Made a ";
echo "<a
href=\"{$website}/blog.php?bt={$row['blogtextid']}\">comment</a>";
echo " in " ;
echo "<a
href=\"{$website}/blog.php?b={$row['blogid']}\">{$row['title2']}</a><br />";
echo $comment. " in " ;
echo "<a
href=\"{$website}/blog.php?b={$row['blogid']}\">{$row['title2']}</a>";
echo "<br /></td></tr>";
}
?>