Jump to content

Lonelydreamer

Members
  • Posts

    42
  • Joined

  • Last visited

Posts posted by Lonelydreamer

  1. FINALLY I FIXED IT the three lines had one thing in common the $connection variable came FIRST!!!!!! That was hours wasted.... if you wanna see the final code look below.

    ><?
    $connection = @mysql_connect("localhost", "user", "pass") or die(mysql_error() );
    $db = @mysql_select_db(db, $connection) or die(mysql_error() );
    $amt = @mysql_query("SELECT * FROM sites", $connection) or die(mysql_error());
    $amt1 = @mysql_num_rows($amt);
    $amt1 = $amt1 - 1;
    $banner = rand(0, $amt1);
    $sql = "SELECT * FROM sites LIMIT $banner,1";
    $result = @mysql_query($sql, $connection) or die(mysql_error());
    while ($row = mysql_fetch_array($result)) {
    $link = $row[url];
    $img = $row[pic];
    $out_put = "<center><a href=\"http://lonelydreamer.com/?page=home\"><img src=\"images/bannertop.gif\" border=0></a><br>\n";
    $out_put .= "<a href=\"http://$link\"><img src=\"banners/$img\" border=0></a><br>\n";
    $out_put .= "<a href=\"http://lonelydreamer.com/?page=join\"><img src=\"images/bannerbottom.gif\" border=0></a><br></center>\n";
    }
    print $out_put;
    ?>

     

    Thanks for your help all!!

  2. These three lines are the ones w/ probs

    >$result = @mysql_query($connection, $sql) or die(mysql_error());
    $amt = @mysql_query($connection, "SELECT * FROM sites") or die(mysql_error());
    $database = @mysql_db_select($connection, mbgriclz_banners) or die(mysql_error());

    please advise!

  3. That didn't help either but I know for sure there is a prob with the PHP and not the data base because the text out side of the PHP block I have recently added will not show either!

    This is what I have as of now:

    ><?
    error_reporting(E_ALL);
    $connection = @mysql_connect("localhost", "user", "pass") or die(mysql_error());
    $database = @mysql_db_select($connection, database) or die(mysql_error());
    $amt = @mysql_query($connection, "SELECT * FROM sites") or die(mysql_error());
    $amt1 = @mysql_num_rows($amt);
    $banner = rand(1, $amt1);
    $sql = "SELECT * FROM sites LIMIT $banner,1";
    $result = @mysql_query($connection, $sql) or die(mysql_error());
    $row = @mysql_fetch_array($result);
    $link = $row[url];
    $img = $row[pic];
    $out_put = "<a href=\"http://lonelydreamer.com/?page=home\"><img src=\"images/banner_top.gif\" border=0></a><br>\n";
    $out_put .= "<a href=\"http://$link\"><img src=\"banners/$img\" border=0></a><br>\n";
    $out_put .= "<a href=\"http://lonelydreamer.com/?page=join\"><img src=\"images/banner_bottom.gif\" border=0></a><br>\n";
    print $out_put;
    ?>
    asdfds

×
×
  • Create New...