1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

stats

Discussion in 'HTML & Website Design' started by aa33030, Aug 28, 2006.

  1. #1
    Hi
    I would like to convert this php/html code into the new php/html code so that when I insert it into a new template it will connect to my sql database:

    <!-- Stats begin -->



    <?

    //Ovo na dalje treba

    mysql_connect($db_host, $db_user, $db_pwd);

    mysql_select_db($db_name);



    // Users Count

    $t1 = mysql_query("SELECT * FROM user") or die (mysql_error());

    $c1 = mysql_num_rows($t1);



    // Upgraded Users Count

    $t1 = mysql_query("SELECT * FROM user WHERE acctype='2' ") or die (mysql_error());

    $c2 = mysql_num_rows($t1);



    // Total invested

    $t1 = mysql_query("SELECT * FROM investment_history WHERE amount>'0' ") or die (mysql_error());

    $c3 = 0;

    while ($t2 = mysql_fetch_array($t1))

    { $c3 = $c3 + $t2['amount']; }



    // Total Payouts

    $t1 = mysql_query("SELECT * FROM cashout_history WHERE amount>'0' ") or die (mysql_error());

    $c4 = 0;

    while ($t2 = mysql_fetch_array($t1))

    { $c4 = $c4 + $t2['amount']; }



    // Sites in rotation

    $t1 = mysql_query("SELECT * FROM site") or die (mysql_error());

    $c5 = mysql_num_rows($t1);





    echo "<small>";

    echo "Total Users <b>$c1</b> | ";

    echo "Upgraded Users <b>$c2</b> | ";

    echo "Total Upgrades <b>$".$c3."</b> | ";

    echo "Total Payouts <b>$".$c4."</b> | ";

    echo "Sites In Rotation <b>$c5</b>";

    echo "</small>";

    ?>

    <!-- Stats end -->

    The above code is the code for an autosurf stats

    When I insert it into a template it doesn't connect to the sql database
     
    aa33030, Aug 28, 2006 IP