ID: 13905 Updated by: sniper Reported By: [EMAIL PROTECTED] Old Status: Open Status: Bogus Bug Type: MySQL related Operating System: RedHat Linux 7.1 PHP Version: 4.0.4pl1 New Comment:
Your script is buggy. Not a PHP bug -> Bogus. Ask support questions on the mailing lists: http://www.php.net/support.php --Jani Previous Comments: ------------------------------------------------------------------------ [2001-11-01 22:10:44] [EMAIL PROTECTED] When running a simple query using the mysql_list_fields() function, I get an error no. 1064. Below: 1. HTML output 2. code I used to produce the error 3. Table definition from mysql 1. HTML output -------------- All's fine here: $query = 'mysql_list_fields('vocmaster_db','nouns_dehd',Resource id #1)' safe_query: $query = mysql_list_fields('vocmaster_db','nouns_dehd',Resource id #1) Query failed: errorno = 1064 error = You have an error in your SQL syntax near 'mysql_list_fields('vocmaster_db','nouns_dehd',Resource id #1)' at line 1 query = mysql_list_fields('vocmaster_db','nouns_dehd',Resource id #1) page = 2. Code ------- function get_table_fields($database="",$table="",$debug) { $link=mysql_connect("localhost","root",""); if(empty($table) or empty($database)) { return FALSE; } $query = "mysql_list_fields('vocmaster_db','nouns_dehd',$link)"; echo("All's fine here: \$query = '$query'"); $result = safe_query($query,$debug); $num_fields = mysql_num_fields($result); echo "Table '$table' contains $num_fields fields:<ol>"; for ($i=0; $i < $num_fields; ++$i) { echo ("<li> mysql_field_name($result,$i) </li>"); } echo("</ol>"); } function safe_query ($query="",$debug) { echo("safe_query: \$query = $query"); if($debug) { if (empty($query)) { return FALSE; } $result = mysql_query($query) or die("<br> Query failed: " ."<ul>" ." <li> errorno = " . mysql_errno() ." <li> error = " . mysql_error() ." <li> query = " . $query ." <li> page = " . $PHP_SELF ."</ul>" ); } else { if (empty($query)) { return FALSE; } $result = mysql_query($query) or die("Query failed. Please contact the webmaster."); } return $result; } 3. table definition from mysql ------------------------------ mysql> describe nouns_dehd; +------------+-------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------------+------+-----+---------+----------------+ | id | int(6) unsigned | | PRI | NULL | auto_increment | | singular | varchar(25) | | | | | | plural | varchar(25) | | | | | | gender | enum('m','f','n') | | | m | | | definition | varchar(250) | YES | | NULL | | +------------+-------------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec) ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13905&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]