PHP 4.0 Bug #7732: php.exe crashes when you make a query using 'select * from table_name'
| From: | pedronaranjo at yahoo dot com | Date: | Thu, 09 Nov 2000 17:58:35 +0000 |
| Subject: | PHP 4.0 Bug #7732: php.exe crashes when you make a query using 'select * from table_name' | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37599@lists.php.net to get a copy of this message | ||
From: pedronaranjo@yahoo.com
Operating system: NT 4 ws SP5
PHP version: 4.0.3pl1
PHP Bug Type: MSSQL related
Bug description: php.exe crashes when you make a query using 'select * from table_name'
Hi there...
Here is the problem... using the dll extention for MS SQL Server 7 and using the code below:
---------------Code----------------
unction MySql_DB_Select($server, $user, $pass, $db, $sql,$before ,$layout, $after)
{
//open a connection
$connection = mysql_connect($server, $user, $pass);
//built the query
//$query = "select linkname, link from links";
//run the query and get the results
$result = mysql_db_query($db, $sql, $connection);
$buffer = "";
while ($myrow = mysql_fetch_array($result))
{
$fieldcount = mysql_num_fields($result);
for ($i=0; $i<$fieldcount; $i++)
{
$fieldnames[$i] = mysql_fieldname($result, $i);
}
//replace the layout with values
$tmp = $layout;
foreach($fieldnames as $fieldname)
{
//print "$fieldname - $myrow[$fieldname]<br>";
$tmp = str_replace("<!--<<" . $fieldname . ">>-->",
$myrow[$fieldname], $tmp);
}
$buffer = $buffer . $tmp;
}
return "-->" . $before . $buffer . $after . "<!--";
mysql_free_result($result);
}
---------------Code----------------
PHP.exe crashes with the following error:
---------------Error---------------
Window Title: OleMainThreadWndName: php.exe
Window Message: The instruction at "0x7800d60" refrence memory at "0x0000004".
The memory could not be written.
---------------Error---------------
The crash happend when I pass the following value to the var $sql
Example:
$sql = "select * from customer"
Now... if I pass this value
Exmaple:
$sql = "select name from customer"
It works with no problem...
--
Edit Bug report at: http://bugs.php.net/?id=7732&edit=1