coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Horst on July 19, 2006, 01:11:30 AM

Title: The good old "Failed to find block 'file_line'" and some new cause
Post by: Horst on July 19, 2006, 01:11:30 AM
Hello everybody,

here my situation:

1. I include a custom header (header.php) via the admin menu.
2. In the custom header a custom PHP script (shoutbox.php) is included.
3. This shoutbox.php is calling a database.
4. --> Template Error Failed to find block 'file_line'. Coppermine is showing me:


Template error
Failed to find block 'file_line'(#(<!-- BEGIN file_line -->)(.*?)(<!-- END file_line -->)#s) in :

        <tr>
                <td class="tableb" align="center">
                        <font size="3"><b>{MESSAGE}</b></font>


                        <br /><br />
                </td>
        </tr>




After a long time of reading forum and debugging I can name the following line of "shoutbox.php" as the cause of the error:



$link = mysql_connect($myConfig['db_addr'], $myConfig['db_user'], $myConfig['db_pass']);
if ($link)
{
// select db
$db_selected = mysql_select_db($myConfig['db_db']);  // <---------------- this one
}


Without this database call the header is working fine and does not produce any errors and also my template is ok. The reason of the error is definitely the "mysql_select_db()" call!

How to solve this?  ??? I really need to call the database there.

Horst
Title: Re: The good old "Failed to find block 'file_line'" and some new cause
Post by: Nibbler on July 19, 2006, 01:37:41 AM
Is the shoutbox usign a different db to Coppermine? If so then you need to make sure it uses its own db connection exclusively.

Tell it to behave itself and use its own connection

$db_selected = mysql_select_db($myConfig['db_db'], $link);

You'll need to do that for all the mysql_query() calls too.

If not, then you need to tell it to make it's own connection to the db instead of sharing coppermine's.

$link = mysql_connect($myConfig['db_addr'], $myConfig['db_user'], $myConfig['db_pass'], true);
Title: Re: The good old "Failed to find block 'file_line'" and some new cause
Post by: Horst on July 19, 2006, 10:25:43 AM
Bingo!!! Great, i changed my database callings and querys and also the database opening calls the way you showed me and - it works fine  ;D.

Thank you.

Horst