Please take a look at this php code and find out what is wrong
Source: Internet
Author: User
Please take a look at this php code and find out what is wrong & lt ;? Phpmysql_connect (& quot; localhost & quot;, & quot; root & quot;, & quot;) or & nbsp; die (& quot; couldnot ask someone to check the php code and find out what is wrong.
Mysql_connect ("localhost", "root", "") or
Die ("cocould not connect:". mysql_error ());
Mysql_select_db ("sdedecmsv57utf8sp1 ");
$ Result = mysql_query ("SELECT title FROM dede_archives ");
$ File_index = 1;
$ I = 1;
While ($ row = mysql_fetch_array ($ result, MYSQL_NUM )){
! $ I % 20? $ File_index ++: $ I ++;
File_put_contents ($ file_index. 'txt ', $ row [0], FILE_APPEND );
}
Mysql_free_result ($ result );
?>
------ Solution --------------------
Pending
! $ I % 20? $ File_index ++: $ I ++;
Success
If ($ I % 20 = 0 ){
$ File_index ++;
}
$ I ++;
Because no matter whether a new $ file_index is generated, $ I needs to grow.
Are you sure you want the result?
------ Solution --------------------
This is generally caused by an SQL statement. you can run the SQL statement in phpadmin or mysql command line to check whether the result is correct. It should be a statement error.
------ Solution --------------------
Mysql_select_db ("sdedecmsv57utf8sp1 ");
The default database for dede installation is dedecmsv57utf8sp1. You seem to have added an extra's'
The database connection error may only occur if it is not enough to be removed.
------ Solution --------------------
The question mark I remember was written in Chinese.
------ Solution --------------------
Discussion
Reference:
No database selected
No database is selected. Check which part is wrong.
Well, it's the database name. I accidentally added a second.
I would like to ask how to write a row that is saved as a title?
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