Questions about getting mysql field comments

Source: Internet
Author: User
Comment out the mysql field & lt ;? Phpinclude (& quot; conn. php & quot;); & nbsp; $ query & quot; select * frommenu & quot; & nbsp; $ resultmysql_query ($ query); & nbsp; for ($ i0; $ I & lt; mysql_num_fields ($ resu comment out mysql fields
Include ("conn. php ");
$ Query = "select * from menu ";
$ Result = mysql_query ($ query );
For ($ I = 0; $ I {
$ Temp = mysql_field_name ($ result, $ I );
Echo $ temp .":";
$ Query_1 = "select column_comment from INFORMATION_SCHEMA.Columns where table_name = 'admin' and table_schema = 'phpdata' and column_name like '$ temp '";
$ Result_1 = mysql_query ($ query_1 );
$ Row_1 = mysql_fetch_row ($ result_1 );
Echo $ row_1 [0]."
";
}
?>

This code can be run locally.
However, you can only retrieve the field name on the server, not the comment.

The table name and database name are correct.

What is the reason? is there any permission to activate it?


Id:
Warning: mysql_fetch_row (): supplied argument is not a valid MySQL result resource in/www/users/swd888.com/1.php on line 11



------ Solution --------------------
You failed to run this sentence.
$ Result_1 = mysql_query ($ query_1 );
After outputting the $ query_1 statement, copy it to the database and run it.
Or add an or die ($ mysql_error () after the query. see the error message.
------ Solution --------------------
Wrong password? Why is it rejected?
I forgot to ask, is your database connected? why is there no mysql_connect?

------ Solution --------------------
You are not authorized to access the INFORMATION_SCHEMA database. Try it with the root user.
------ Solution --------------------
Check your conn. php function, and add
PHP code
If (! $ Con) {die ('could not connect: '. mysql_error ());}
------ Solution --------------------
Show full fields from table // try this way
------ Solution --------------------
$ Query_1 = "show full columns from phpdata from admin like '$ temp '";
$ Result_1 = mysql_query ($ query_1 );
$ Row_1 = mysql_fetch_row ($ result_1 );
Echo $ row_1 ['comment']."
";

Try it

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.