php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11045 Odd MSSQL errors about 25% of the time
Submitted: 2001-05-23 04:27 UTC Modified: 2001-08-10 23:51 UTC
From: uhl at cis dot ohio-state dot edu Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.0.5 OS: Win2K
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: uhl at cis dot ohio-state dot edu
New email:
PHP Version: OS:

 

 [2001-05-23 04:27 UTC] uhl at cis dot ohio-state dot edu
Below is an example of the series of errors I get when loading a page on my website.  What is odd about it is that the errors do not always occur.  About 75% of the time, the page works perfectly.  Then I'll refresh the page without even making any changes to the source and the errors will occur.  Refresh again and they disappear and the page works.

Another interesting occurance.  Sometimes, the first queries that are run will run and complete successfully, but then a query that comes later in the source on the same page will cause these errors.

Warning: MS SQL error: Invalid parameter in DB-LIBRARY function reference. (severity 11) in c:\www\demoxpress.com\html\db.inc.php on line 4

Warning: MS SQL: Unable to select database: demoXpress in c:\www\demoxpress.com\html\db.inc.php on line 4
Cannot select demoXpress DB. 
 

Warning: MS SQL error: Invalid parameter in DB-LIBRARY function reference. (severity 11) in c:\www\demoxpress.com\html\class_menu.php on line 30

Warning: MS SQL: Unable to set query in c:\www\demoxpress.com\html\class_menu.php on line 30

Warning: Supplied argument is not a valid MS SQL-result resource in c:\www\demoxpress.com\html\class_menu.php on line 31

Warning: Supplied argument is not a valid MS SQL-result resource in c:\www\demoxpress.com\html\class_menu.php on line 32
 


Warning: MS SQL error: Invalid parameter in DB-LIBRARY function reference. (severity 11) in c:\www\demoxpress.com\html\class_menu.php on line 30

Warning: MS SQL: Unable to set query in c:\www\demoxpress.com\html\class_menu.php on line 30

Warning: Supplied argument is not a valid MS SQL-result resource in c:\www\demoxpress.com\html\class_menu.php on line 31

Warning: Supplied argument is not a valid MS SQL-result resource in c:\www\demoxpress.com\html\class_menu.php on line 32
 

Warning: MS SQL: Unable to set query in c:\www\demoxpress.com\html\class_newsmachine.php on line 52

Warning: Supplied argument is not a valid MS SQL-result resource in c:\www\demoxpress.com\html\class_newsmachine.php on line 58
 
Warning: MS SQL error: Invalid parameter in DB-LIBRARY function reference. (severity 11) in c:\www\demoxpress.com\html\class_pollbox.php on line 22

Warning: MS SQL: Unable to set query in c:\www\demoxpress.com\html\class_pollbox.php on line 22

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-23 07:32 UTC] fmk@php.net
Could you provide some sample code ? And are you using CGI or ISAPI ?
 [2001-05-23 09:26 UTC] uhl at cis dot ohio-state dot edu
Yes, I can piece some together.  Most of the stuff is seperated into different files and classes so i'll just put examples of the database accesses in the order they happen.

I am using ISAPI with Apache 1.3.19 and MS SQL Server 2k on Win2k Server SP1.

Hope this helps.

/* db.inc.php */
	global $db_conn;
	$db_conn = mssql_pconnect ('localhost', '***', '***') or printf ('Cannot connect to SQL Server.');
	mssql_select_db ('demoXpress') or printf ('Cannot select demoXpress DB.');

/* class_menu.php */
if (!empty($this->Name))
{
	$sql = "SELECT * FROM Menus WHERE Name='{$this->Name}'";
	$rs = mssql_query ($sql);
	$this->Menu = mssql_fetch_object($rs);
	mssql_free_result($rs);
}

/* class_newsmachine.php */
$sql  = 'SELECT NewsID, News.SectionID, News.Poster, CONVERT(varchar(50), News.PostDate, 120) AS PostDate, ';
$sql .= 'Title, Teaser, DATALENGTH(Content) AS ContentLength, News.ViewCount, ';
$sql .= 'Sections.Name, Sections.Icon, ISNULL(MessageCount, -1) AS CommentCount ';
$sql .= 'FROM News, Sections, mb_Topics ';
$sql .= 'WHERE (News.CommentID*=mb_Topics.TopicID) AND (News.SectionID=Sections.SectionID) AND (News.FrontPage=1) ';
$sql .= 'ORDER BY News.PostDate DESC';

if (!($this->NewsRS = mssql_query ($sql, $db_conn))) echo mssql_get_last_message();
 [2001-06-30 15:00 UTC] fmk@php.net
An error in mssql_pconnect() was fixed in php 4.0.6. Please update and try again.
 [2001-08-10 23:51 UTC] uhl at cis dot ohio-state dot edu
Sorry, I updated a while ago, but didn't check back here.  Unfortunately, the error still occurs.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 04:01:28 2024 UTC