Results 1 to 6 of 6
  1. #1

    PHP script no longer working

    I have virtually no experience coding and have had this piece for a couple years and just update it as needed for each year. For some reason, this script is no longer working starting tonight. I use it on two different servers at different hosts and they both stopped working tonight. Here is the code if anyone can help me out:

    PHP Code:
    <?php

    $dbcnx 
    = @mysql_connect("xxxxxx""xxxxxx""xxxxxx");
    mysql_select_db("xxxxxx");

    // The basic SELECT statement
    $select "SELECT *";
    $from   " FROM schedules";
    $where  " WHERE ID > 0";

    if (
    $aid != "") { // An team is selected
      
    $where .= " AND ID=$aid";
    }


    ?>




    <?php
    $jokes 
    mysql_query($select $from $where);
    if (!
    $jokes) {
      echo(
    "</TABLE>");
      echo(
    "<P>Error retrieving teams from database!<BR>".
           
    "Error: " mysql_error());
      exit();
    }


    while (
    $joke mysql_fetch_array($jokes)) {
      echo(
    "<TR>\n");
      
    $unique=$joke["Unique"];
      
    $date=$joke["Date"];
      
    $id=$joke["ID"];
      
    $team=$joke["Team"];
      
    $at=$joke["Where"];
      
    $oid=$joke["OID"];
      
    $opponent=$joke["OTeam"];
      
    $teamscore=$joke["Score"];
      
    $oscore=$joke["OScore"];
      echo(
    "<TD align=right><font size=1>$date</font></TD><TD align=right><font size=1>$id</font></td><td><font size=2>$team</font></TD>\n");
      echo(
    "<TD align=center><font size=1>$at</font></TD><TD align=right><font size=1>$oid</font></td><TD><font size=2>$opponent</font></TD><TD align=right><font size=2><b>$teamscore</b></font></td><TD align=right><font size=2><b>$oscore</b></font></td><TD align=right><font size=2>Report Score</font></td>\n");
      echo(
    "</TR>\n");
    }
    ?>
    Thanks for any help!
    Last edited by dollar; 02-07-2008 at 02:09 AM. Reason: PHP Tags for easier reading

  2. #2
    Join Date
    Sep 2004
    Location
    Flint, Michigan
    Posts
    5,765
    What type of error is it giving you?
    Mike from Zoodia.com
    Professional web design and development services.
    In need of a fresh hosting design? See what premade designs we have in stock!
    Web design tips, tricks, and more at MichaelPruitt.com

  3. #3
    This is a basketball schedules/results database. The ID is for each school with each having 20 games. The way it worked, you selected an ID and it gave you that school's 20 games. Now, it gives you the entire database of 15,000 games no matter which ID you choose.

  4. #4
    Join Date
    Sep 2004
    Location
    Flint, Michigan
    Posts
    5,765
    I would start out by echoing out the actual query right above where it is ran. I.e.

    PHP Code:
    echo($select $from $where);
    $jokes mysql_query($select $from $where); 
    This would like you see what is being sent to the database server. I would guess that the problem is most likely with this line:

    PHP Code:
    if ($aid != "") { // An team is selected 
    How are you filling the data in $aid? If you are relying on register_globals to be turned on that's most likely your problem. register_globals is set to off by default and is even slated to be removed from PHP in version 6.
    Mike from Zoodia.com
    Professional web design and development services.
    In need of a fresh hosting design? See what premade designs we have in stock!
    Web design tips, tricks, and more at MichaelPruitt.com

  5. #5
    try adding

    if($_GET[aid]){ $aid = $_GET[aid]; )
    if($_POST[aid]){ $aid = $_POST[aid]; )

    that should fix the problem if you are having a register globals problem...
    http://limehosting.com

  6. #6
    Quote Originally Posted by joeshacks View Post
    try adding

    if($_GET[aid]){ $aid = $_GET[aid]; )
    if($_POST[aid]){ $aid = $_POST[aid]; )

    that should fix the problem if you are having a register globals problem...
    That did the trick! Thanks to both of you for helping out!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •