Why do I get zero sized reply???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pawe³

    Why do I get zero sized reply???

    Why after running the following script do I get zero sized reply??
    It seems to hang when I access the $link_id (when comparing it, negating,
    reading and so on) but it isn't an expected behaviour. Any clues??
    Thanks,
    Pawel Galecki


    <?php
    //db_connect.php
    include "common_db.inc" ;
    error_reporting (0);

    $link_id = db_connect();
    if(!$link_id) die(sql_error() );
    else echo "Successful ly made a connection to $dbhost.<BR>";
    ?>

    <?php
    //common_db.inc
    $dbhost = 'localhost';
    $dbusername = 'phpuser';
    $dbuserpassword = 'phppass';
    $default_dbname = 'mysql';

    $MYSQL_ERRNO = '';
    $MYSQL_ERROR = '';

    function db_connect() {
    global $dbhost, $dbusername, $dbuserpassword , $default_dbname ;
    global $MYSQL_ERRNO, $MYSQL_ERROR;

    $link_id = mysql_connect($ dbhost, $dbusername, $dbuserpassword );
    if(!$link_id) {
    $MYSQL_ERRNO = 0;
    $MYSQL_ERROR = "Connection failed to the host $dbhost.";
    return 0;
    }
    else if(empty($dbnam e) && !mysql_select_d b($default_dbna me)) {
    $MYSQL_ERRNO = mysql_errno();
    $MYSQL_ERROR = mysql_error();
    return 0;
    }
    else return $link_id;
    }

    function sql_error() {
    global $MYSQL_ERRNO, $MYSQL_ERROR;

    if(empty($MYSQL _ERROR)) {
    $MYSQL_ERRNO = mysql_errno();
    $MYSQL_ERROR = mysql_error();
    }
    return "$MYSQL_ERR NO: $MYSQL_ERROR";
    }
    ?>
Working...