• Hi,

    I’m using StarSol’s Random Quote script (http://www.starsol.co.uk/scripts/scripts.php).

    When I add a simple php include call to it:
    <?php include “../quotes/quotation.php”; ?>
    The quote is included as expected but Archives has no links and Categories now says “no categories” in the sidebar.

    Strangely, I remove my include line, and the categories, archives and links are working again in the sidebar. What could be causing this?

    The quotes script is a simple database query with an “echo” statement at the end that outputs the quote. For example, you can load this page over and over and it works:
    http://nimbleswitch.com/quotes/quotation.php

    but trying to include it in php causes some serious havoc.
    Any ideas?

    Kato

    PS the code for the quotation script looks like this:

    <?php

    require (‘quotation_includes.php’);

    connect_to_mysql();

    $how_many = mysql_num_rows(mysql_query(“SELECT quotation FROM “.$db_prefix.”quotations”));
    $how_many_minus_one = $how_many – 1;

    $random = rand(0,$how_many_minus_one);

    $rq = mysql_fetch_array(mysql_query(“SELECT quotation FROM “.$db_prefix.”quotations LIMIT “.$random.”, 1″));

    $rq[quotation] = nl2br($rq[quotation]);

    mysql_close();

    echo $rq[quotation];

    ?>

  • The topic ‘adding a simple php include breaks archives, categories, and links’ is closed to new replies.