php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6065 Returns a "The document contained no data" error while accessing MS-SQL 7.0
Submitted: 2000-08-10 05:16 UTC Modified: 2000-10-20 17:12 UTC
From: jms18 at guinness dot som dot cwru dot edu Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.0.1pl2 OS: Red Hat 6.1
Private report: No CVE-ID: None
 [2000-08-10 05:16 UTC] jms18 at guinness dot som dot cwru dot edu
	Here is the source:

<?

PrintHeader();

DisplayQueue();

PrintClose();

function PrintHeader()
{
	print("<HTML>\n<HEAD>\n<TITLE>\nPHP Helpdesk v0.0.1 Alpha\n</TITLE></HEAD>\n<BODY>\n");
}

function PrintClose()
{
	print("\n</BODY>\n</HTML>");
}

function ConnectDB($Server,$Database,$DBUser,$DBPsswrd)
{
	$mssql_link = mssql_connect($Server,$DBUser,$DBPsswrd) or DIE("SERVER FAILED TO RESPOND.");
 
	mssql_select_db($Database) or DIE("Database unavailable");

	return $mssql_link; 
}

function RunQuery($Query, $Fetch, $Link)
{
	if ($Fetch == 1)
	{
		return mssql_fetch_row(mssql_query($Query,$Link));
	}
	else
	{
		return mssql_query($Query,$Link);
	}
}

function OpenTable($Alignment,$ColNumber,$CellSpace,$Border,$CellPadding,$Width)
{
	print("<TABLE ALIGN=$Alignment COLS=$ColNumber CELLSPACING=$CellSpace BORDER=$Border CELLPADDING = $CellPadding WIDTH=$Width>\n");
}

function DisplayQueue()
{
	$MSsqlLink = ConnectDB("Server","Datbase","user","password");

	$Result = RunQuery("select * from tbl_WO_Entry, tbl_WO_Description, tbl_WO_Classification where ((tbl_WO_Entry.WO_nos = tbl_WO_Description.WO_nos and tbl_WO_Entry.WO_nos = tbl_WO_Classification.WO_nos) and (not (tbl_WO_Entry.status = 3 and tbl_WO_Entry.status = 4 and tbl_WO_Entry.status = 5))) order by tbl_WO_Entry.Priority,tbl_WO_Entry.WO_nos",0,$MSsqlLink);

	OpenTable("CENTER",5,0,1,0,"100%");

	print("<TR>\n<TH WIDTH=\"5%\">WO#</TH>\n<TH WIDTH=\"10%\">User</TH>\n<TH WIDTH=\"5%\">Priority</TH>\n");
	print("<TH WIDTH=\"60%\" ABBR>Description</TH>\n<TH WIDTH=\"10%\">Status</TH>\n</TR>\n");

	$Number = mssql_num_rows($Result);

	print("$Number<BR>");
	
	while($WORS = mssql_fetch_row($Result))
	{
		PrintQueueRow($WORS[0],$WORS[1],$WORS[3],$WORS[5],$WORS[2]);
	}
	
	print("</TABLE>\n");

	mssql_close();
}

function PrintQueueRow($WONos,$UserName,$Priority,$Description,$Status)
{
	print("<TR>\n<TD>$WONos</TD>\n<TD>$UserName</TD>\n<TD>$Priority</TD>\n");
	print("<TD>$Description</TD>\n<TD>$Status</TD>\n</TR>\n");
}

?>





Here is the backtrace:

cd htdocs[root@som00258 apache]# gdb /usr/local/apache/bin/httpd
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
(gdb) run -X
Starting program: /usr/local/apache/bin/httpd -X
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x80e4843 in zend_hash_index_find ()
(gdb)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-10 05:18 UTC] jms18 at guinness dot som dot cwru dot edu
I can access the database (MS-SQL 7.0 service pack 1) from other scripts.  It is one I try to loop through the reordset that it will die.
 [2000-08-11 00:54 UTC] jms18 at guinness dot som dot cwru dot edu
Here is a shorter script that produces the same results:


<?

print("<HTML>\n<HEAD>\n<TITLE>\nPHP Helpdesk v0.0.1 Alpha\n</TITLE></HEAD>\n<BODY>\n");

$MSsqlLink =  mssql_connect("Server","User","password") or DIE("SERVER FAILED TO RESPOND.");
 
mssql_select_db("Database") or DIE("Database unavailable");

$Result = mssql_query("select tbl_WO_Entry.WO_nos,tbl_WO_Entry.UserName,tbl_WO_Entry.Status,tbl_WO_Entry.Priority,tbl_WO_Description.Problem_description from tbl_WO_Entry, tbl_WO_Description where ((tbl_WO_Entry.WO_nos = tbl_WO_Description.WO_nos) and (not (tbl_WO_Entry.status = 3 and tbl_WO_Entry.status = 4 and tbl_WO_Entry.status = 5))) order by tbl_WO_Entry.Priority,tbl_WO_Entry.WO_nos",$MSsqlLink);

print("<TABLE ALIGN=CENTER COLS=5 CELLSPACING=0 BORDER=1 CELLPADDING=0 WIDTH=\"100%\">\n");

print("<TR>\n<TH WIDTH=\"5%\">WO#</TH>\n<TH WIDTH=\"10%\">User</TH>\n<TH WIDTH=\"5%\">Priority</TH>\n");
print("<TH WIDTH=\"60%\" ABBR>Description</TH>\n<TH WIDTH=\"10%\">Status</TH>\n</TR>\n");

$WORS = mssql_fetch_row($Result);

print("<TR>\n<TD>$WORS[0]</TD>\n<TD>$WORS[1]</TD>\n<TD>$WORS[3]</TD>\n");
print("<TD>$WORS[4]</TD>\n<TD>$WORS[2]</TD>\n</TR>\n");

$WORS = mssql_fetch_row($Result);

print("<TR>\n<TD>$WORS[0]</TD>\n<TD>$WORS[1]</TD>\n<TD>$WORS[3]</TD>\n");
print("<TD>$WORS[4]</TD>\n<TD>$WORS[2]</TD>\n</TR>\n");

$WORS = mssql_fetch_row($Result);

print("<TR>\n<TD>$WORS[0]</TD>\n<TD>$WORS[1]</TD>\n<TD>$WORS[3]</TD>\n");
print("<TD>$WORS[4]</TD>\n<TD>$WORS[2]</TD>\n</TR>\n");

$WORS = mssql_fetch_row($Result);

print("<TR>\n<TD>$WORS[0]</TD>\n<TD>$WORS[1]</TD>\n<TD>$WORS[3]</TD>\n");
print("<TD>$WORS[4]</TD>\n<TD>$WORS[2]</TD>\n</TR>\n");
	
print("</TABLE>\n");

mssql_close();

print("\n</BODY>\n</HTML>");

?>

 [2000-10-20 17:12 UTC] fmk@php.net
Some memory issues was fixed in php 4.0.3, and additional fixxes is available in cvs. Please update and try again.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 07:03:33 2021 UTC