472,964 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,964 software developers and data experts.

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 "Successfully 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($dbname) && !mysql_select_db($default_dbname)) {
$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_ERRNO: $MYSQL_ERROR";
}
?>
Jul 17 '05 #1
0 8146

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sackal | last post by:
Hi! After uploading an jpeg-File I want to create a thumbnail by using a function which contains the gd-Function imagecreatefromjpeg. But that function doesn't return and I got the...
25
by: prashna | last post by:
Hi all, I have seen a piece of code(while doing code review) which declared an array of size 0.One of my friend told although it is not standard C,some compilers will support this..I am very...
31
by: RS | last post by:
Hi, Looking to see if the following construct is valid: typedef struct { int foo; char bar; } foobar; Basically, the idea is to have the structure above point to a message buffer that has...
3
by: Adel | last post by:
Hello. Is the statement below proved by the ANSI C standard? "It is undesirable to use explicitly sized variables in functions as auto variables or parameters. The values will always be stored as...
4
by: fabio | last post by:
Hello, zero-sized arrays (which I find very useful, since I do a lot of packet-style programming with circular buffers) cannot be declared if they're in a struct/class that later will be inherited...
8
by: pranav.choudhary | last post by:
Is it legal to keep the size of an array 0. gcc 3.4.2 did not give any error for the declaration int a; If the declaration is legal, then what will be the implications of saying a = 10;
5
by: Lyle Avery | last post by:
Hello guys, Look at this in c++ file: class T { public: char c; char ca; };
64
by: Robert Seacord | last post by:
The C standard doesn't say anything about what happens when you call realloc with a size argument of 0. Both glibc and openbsd appear to return a valid pointer to a zero-sized object.. e.g. the...
33
by: Zytan | last post by:
I want to make a zero element array. I know that Nothing is not the same as a zero element array, since I can't get the length of, or iterate through, an array = Nothing. I could make a zero...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.