Topic: Cutenews does not display on pages where another database is called

I have certain information that I want to display on a sidebar, the values of which are pulled from a mysql database. This works fine on all pages, but when I visit the page where cutenews is set to display, the area that cutenews should be in is blank.

If I remove it from the sidebar, then cutenews displays again just fine.

I'm not really sure what to do about this. Does anyone know how you can call a mysqldatabase but also have cutenews display, on the same page?

Thanks!

Re: Cutenews does not display on pages where another database is called

Does your server suppress errors? It's always good to know what's going on and what the server isn't happy about.

Could you perhaps share that MySQL script, or at least the important parts? CuteNews doesn't use MySQL but it may be that CuteNews and the other script use the same variable or function or something. Since you say CuteNews shows up once the MySQL script is removed, the cause obviously lies there.

Re: Cutenews does not display on pages where another database is called

I get errors when other bits of script are wonky, but no errors at all are displaying for this particular issue. Cutenews just plain disappears and that's all.

In my sidebar.php file I use the following (I want to display the number of decks I have, for example):

<?php include("mytcg/settings.php") ?> (this has my database info/other variables in it)

<?php
$select_count = mysql_query("SELECT * FROM `$table_cards` WHERE worth='1'");
$num_cards = mysql_num_rows($select_count);
?>
Regular Decks: <?php echo $num_cards; ?>


On all other pages everything shows up fine. The deck count displays correctly as does anything else that's in the main content section. I have other scripts that call successfully on the settings.php file, other includes work, etc etc. There's no errors at all.

But when going to my index.php page, where cutenews is set to show in the main content section, it's just completely blank. Anything I write above or under the cutenews include code shows up just fine, it's just the include itself that doesn't want to work. I can't figure out why it's clashing with this piece of code, especially since cutenews doesn't call on mysql itself. I thought at first there was a conflict and it was getting confused which mysql it was supposed to be using, but that's clearly not the case.

4 (edited by 2013-06-08 08:29:24)

Re: Cutenews does not display on pages where another database is called

Thanks for the update! That piece of code definitely shouldn't clash with CuteNews.
My guess: If you just leave the line

<?php include("mytcg/settings.php") ?>

CuteNews still won't show. If you could verify that, we could know that it's this include line doing some trouble. Could you share the contents of that settings.php file?, minus the obvious sensitive stuff like database password, of course. (If you're worried about privacy, you're very welcome to send me a private message with its contents or post the code here and we can edit it out once your issue is solved.)

Failing that, if you could remove the include() line to mytcg/settings.php and just add some working SQL code as close as possible to that above, it would be interesting to see if CuteNews will show. Right now we're trying to narrow down the problem. https://cutephp.com/forum/style_emoticons/default/smile.gif

Thanks

5 (edited by 2013-06-08 11:27:08)

Re: Cutenews does not display on pages where another database is called

Yup even just using that include with the settings.php makes cutenews not show.

Here's the contents of settings.php

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?php
/*
INSTALLATION INFORMATION
username = The username for the admin panel
password = The password for the admin panel
*/

$user = 'xxxx';
$pass = 'xxxx';

/*
EMAIL & WEBSITE VARIABLES
$tcgemail = The email address you use for all TCG mail
$tcgname = The name of your TCG
$tcgurl = Your TCG's URL

$header = The full path to your header file

$footer = The full path to your footer file

$width = The width of your cards
$height = The height of your cards

$ext = Your card extension, ie. gif, png, jpg
*/

$tcgemail = 'xxxx';
$tcgname = 'Heartchu';

$tcgowner = 'Taliana, Helix & Osanity';
$tcgurl = 'http://www.heartchu-tcg.com';

$tcgcardurl = 'http://www.heartchu-tcg.com/cards/';

$header = 'header.php';

$footer = 'footer.php';

$width = '92';

$height = '73';

$ext = 'png';



/*DATABASE VARIABLES
$db_server = The database server, usually localhost
$db_user = The username for your database
$db_password = The password for your database
$db_database = The database name
$table_members = The table for the member list.

$table_cards = The table for your card information.

$table_upcoming = The table for your upcoming card list

$table_affiliates = The table for your affiliate information
*/

$db_server = 'xxxx';
$db_user = 'xxxx';
$db_password = 'xxxx';
$db_database = 'xxxx';
$table_members = 'members';
$table_cards = 'cards';
$table_upcoming = 'upcoming';
$table_affiliates = 'affiliates';

$table_games = 'games';



/*
LEVEL VARIABLES

$num_levels = the number of levels your TCG has (not including pending or hiatus/troubled). This number can be changed if you add levels.

$level[] = The level names for your levels. They can be added to if necessary.
$levelcount[] = The number of cards for each level. This is only used on the information page.
*NOTE* There is no pending level. This is because pending is determined by the member's status, not by their level.
*/



$num_levels = '9';

$level[1] = 'n00b';
$level[2] = 'Bronze';
$level[3] = 'Silver';
$level[4] = 'Gold';
$level[5] = 'Platinum';
$level[6] = 'Diamond';
$level[7] = 'Master';
$level[8] = 'Grand Master';
$level[9] = 'Ultimate';

$levelcount[1] = '001-100';
$levelcount[2] = '101-200';
$levelcount[3] = '201-300';
$levelcount[4] = '301-400';
$levelcount[5] = '401-500';
$levelcount[6] = '501-600';
$levelcount[7] = '601-700';
$levelcount[8] = '701-800';
$levelcount[9] = '801-900';

/*
CARD VARIABLES

$num_categories = The number of categories of cards your TCG has. This variable can be changed later if necessary.

$category[] = The category names for your card categories. They can be added to if necessary.

$digits = The number of cards in your regular card decks. Currently the included randomizer only works with regular card decks that are all the same number. If you need a different setup, you will have to edit it yourself or use a different randomizer.

$digits_spc = The number of cards in your special card decks. Currently the included randomizer only works with special card decks that are all the same number. If you need a different setup, you will have to edit it yourself or use a different randomizer.
*/



$num_categories = '4';

$category[1] = 'Artist';
$category[2] = 'Music Video';
$category[3] = 'Photo';
$category[4] = 'Actor';

$digits = array (
    "01",
    "02",
    "03",
    "04",
    "05",
    "06",
    "07",
    "08",
    "09",
    "10",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "19",
    "20"
);


$digits_spc = array (
    "01",
    "02",
    "03",
    "04",
    "05",
    "06",
    "07",
    "08",
    "09",
    "10"
);
$digits_spc2 = array (
    "01",
    "02",
    "03",
    "04",
    "05",
    "06",
    "07",
    "08",
    "09",
    "10",
    "11",
    "12",
    "13",
    "14",
    "15"
);





/*
GAME INFORMATION

$num_gamecats = The number of game categories you have

$gamecat[] = The various categories of games
*/

$num_gamecats = '3';
$gamecat[1] = 'Group A';
$gamecat[2] = 'Group B';
$gamecat[3] = 'Group C';



/*
AFFILIATE INFORMATION

$buttonsize = The size for all affiliate buttons, ie. 88x31.
$buttonurl = The URL to your affiliate image folder WITH TRAILING SLASH
$num_affiliates = The number of affiliate categories you have

$affiliates[] = The various categories of affiliates
*/



$buttonsize = '88x31';
$buttonurl = 'http://www.heartchu-tcg.com/affiliates/';
$num_affiliates = '3';
$affiliates[1] = 'Pending';
$affiliates[2] = 'Active';
$affiliates[3] = 'Hiatus';


/*
FORM INFORMATION

$num_startreg = The number of random regular cards you want to include in your starter pack

$num_startspc = The number of random special cards you want to include in your starter pack

$num_startchoice = The number of cards from the member's collecting deck you want to include in your starter pack

$num_lvlchoice = The number of choice cards included in every level up

$num_lvlreg = The number of random regular cards included in every level up

$num_lvlspc = The number of random special cards included in every level up
$num_maschoice = The number of choice cards included in every mastery

$num_masreg = The number of random regular cards included in every mastery
$num_masspc = The number of random special cards included in every mastery
*/



$num_startreg = '5';

$num_startspc = '0';

$num_startchoice = '2';

$num_lvlchoice = '1';

$num_lvlreg = '2';

$num_lvlspc = '1';

$num_maschoice = '2';

$num_masreg = '3';

$num_masspc = '1';



/********************************************************
** DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU'RE DOING **
********************************************************/

    $users = array($user => md5($pass));
    $salt = substr(md5(date("F")), 8);

    $connect = mysql_connect("$db_server", "$db_user", "$db_password")
        or die( DATABASE_CONNECT_ERROR . mysql_error() );
    mysql_select_db("$db_database", $connect)
        or die( DATABASE_CONNECT_ERROR . mysql_error() );
       
    function CleanUp($data) {
           $data = trim(htmlentities(strip_tags($data)));
           return $data;
        }

    function escape_sql($sql) {
        if (get_magic_quotes_gpc()) $sql = stripslashes($sql);
        return mysql_real_escape_string($sql);
        }
?></div>

Re: Cutenews does not display on pages where another database is called

Oh boy, there so in settings.php that could be messing with cutenews.
Since none of the 2 scripts (Cutenews and the script from settings.php) are object oriented, they have access to eachothers variables.

The most obvious one would be
$category. it's used in settings.php
Cutenews also has that parameter.
and i'm guessing you're notting using it for Cutenews.
So for the $category parameter this could be fixes by using
unset($category);
include('show_news.php');

but i see $db_user in that file, not sure if that would be a problem, but it could.
If it is a problem using
unset($category, $db_user);
include('show_news.php');
would fix it.

Re: Cutenews does not display on pages where another database is called

Thank you so much! Your fixed worked perfectly.