470,855 Members | 1,178 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

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??
Pawel Galecki
include "common_db.inc";

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

$dbhost = 'localhost';
$dbusername = 'phpuser';
$dbuserpassword = 'phppass';
$default_dbname = 'mysql';


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

$link_id = mysql_connect($dbhost, $dbusername, $dbuserpassword);
if(!$link_id) {
$MYSQL_ERROR = "Connection failed to the host $dbhost.";
return 0;
else if(empty($dbname) && !mysql_select_db($default_dbname)) {
$MYSQL_ERRNO = mysql_errno();
$MYSQL_ERROR = mysql_error();
return 0;
else return $link_id;

function sql_error() {

if(empty($MYSQL_ERROR)) {
$MYSQL_ERRNO = mysql_errno();
$MYSQL_ERROR = mysql_error();
Jul 17 '05 #1
0 8074

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Sackal | last post: by
25 posts views Thread by prashna | last post: by
31 posts views Thread by RS | last post: by
4 posts views Thread by fabio | last post: by
8 posts views Thread by pranav.choudhary | last post: by
5 posts views Thread by Lyle Avery | last post: by
64 posts views Thread by Robert Seacord | last post: by
33 posts views Thread by Zytan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.