PHP 4.0 Bug #8513: Call to undefined function: mssql_field_name()

From: Date: Tue, 02 Jan 2001 10:49:44 +0000
Subject: PHP 4.0 Bug #8513: Call to undefined function: mssql_field_name()
Groups: php.dev 
Request: Send a blank email to php-dev+get-42693@lists.php.net to get a copy of this message
From: parentjp@pjp.dhs.org Operating system: Debian GNU/Linux kernel 2.2.17 PHP version: 4.0.4 PHP Bug Type: MSSQL related Bug description: Call to undefined function: mssql_field_name() I'm getting this error with my installation of PHP 4.0.4. I heard it doesnt work in 4.0.2 too. mssql_fetch_field($query, $field_number)->name works though... I use freeTDS 0.51 for the client stuff needed for connection on a remote MS SQL 7 server and used --with-tdsver=7.0 at freeTDS compilation for protocol 7.0. Here's the script (got to modify login, pass, db and hostname vars at beginning): <PRE> <h1>TestSql.php</h1><hr> This is a direct connection to the MS SQL7.0 database. Using PHPver4.01P2 on Win NT/IIS 4.0 <? // YOUR MSSQL 7.0 SERVER PARAMETERS $hostname = "wruslan"; $username = "wruslanpubs"; $password = "wruslanpubs"; // YOUR MSSQL 7.0 DATABASE $dbname = "pubs"; $tablename = "employee" ; // CONNECT TO THE MSSQL 7.0 DATABASE $connection = mssql_connect($hostname,$username,$password); mssql_select_db($dbname); $sql_query = "select * from $tablename" ; $query_result =mssql_query($sql_query) ; $number_rows = mssql_num_rows($query_result) ; $number_fields = mssql_num_fields($query_result) ; // TEST YOUR QUERY if($number_rows == 0) : print " The query does not produce any data row ! " ; elseif ($number_rows > 0) : print " Yes there are " . $number_rows . " rows resulting from the query. " ; endif ; // DISPLAY TABLE FIELD HEADERS print "<table border><tr><th>row</th>" ; for ($field_number = 0 ; $field_number <= $number_fields - 1 ; $field_number++ ) { //************************************** //THE FOLLOWING LINE CAUSES THE PROBLEM! //************************************** $field_name = mssql_field_name($query_result, $field_number) ; print "<th>" . $field_name . "</th>" ; } print "</tr>" ; // DISPLAY INDIVIDUAL ROWS - POPULATING THE TABLE for ($row_number = 0 ; $row_number <= $number_rows - 1 ; $row_number++) { print "<tr><td>" . $row.number . "</td>" ; for ($field_number = 0 ; $field_number <= $number_fields - 1 ; $field_number++) { print "<td>" . mssql_result($query_result, $row_number, $field_number) . "</td>" ; } print "</tr>" ; } print "</table>" ; mssql_close($connection); ?> -- Edit Bug report at: http://bugs.php.net/?id=8513&edit=1

« previous php.dev (#42693) next »