Please visit: php code loop. the previous code verifies that the mysql connection is correct. what I want to achieve here is: if activite returns more than one parameter, it performs an SQL query for each parameter and then displays each query result. However, it is an endless loop, but a parameter is returned and the result is not displayed. is that the case? & Nbsp; mysql_select_db ($ mysql_database, $ link); & nbsp; please refer to php code loop.
The previous code verifies that the mysql connection is correct.
What I want to achieve here is: if activite returns more than one parameter, it performs an SQL query for each parameter and then displays each query result. However, it is an endless loop, but a parameter is returned and the result is not displayed. is that the case?
Mysql_select_db ($ mysql_database, $ link );
If (isset ($ _ POST ["activite"]) {
For ($ I = 0; $ I <count ($ activite); $ I ++ ){
$ Strsql = "select n_naps from activage where famille = '$ activite [$ I]'";
Echo $ strsql;
$ Result = mysql_query ($ strsql );
$ Nb = mysql_num_rows ($ result );
For ($ I = 1; $ I <= $ nb; $ I ++ ){
$ Info = mysql_fetch_row ($ result );
Echo" $ Info [0]
";
}
}
}
Thank you for your advice.
------ Solution --------------------
Error!
1. for ($ I = 0; $ I <count ($ activite); $ I ++ ){
$ Activite value not displayed
2. $ strsql = "select n_naps from activage where famille = '$ activite [$ I]'"
Ying writing
$ Strsql = "select n_naps from activage where famille = '{$ activite [$ I]}'"
------ Solution --------------------
The character set is 2 bytes in the Chinese operating system, and its internal code is related to the character set used.