The previous code verifies that the MySQL connection is correct.
Here I want to achieve is: Activite return more than 1 parameters, the SQL query for each parameter, and then show each query results, but my is a dead loop, but also is to return a parameter, do not show the results, is this 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 great God's advice.
Reply to discussion (solution)
It's a mistake!
1. for ($i =0; $i < count ($activite); $i + +) {
I don't see the $activite assignment.
2. $strsql = "Select N_naps from Activage where famille= ' $activite [$i] '"
Should write
$strsql = "Select N_naps from Activage where famille= ' {$activite [$i]} '"
It's a mistake!
1. for ($i =0; $i < count ($activite); $i + +) {
I don't see the $activite assignment.
2. $strsql = "Select N_naps from Activage where famille= ' $activite [$i] '"
Should write
$strsql = "Select N_naps from Activage where f ...
Moderator, thank you for every time you have to answer some of my idiot questions ah, I put the problem in fine points:
In 1.php there is the following code:
Activités Gymniques
Activités Gymniques Aquatiques
Activités Fitness/forme
Activités Douces/bien-être
2.php receives the parameters in 1.php: The local code is as follows:
Verify that the connection database is correct before.
$activite =isset ($_post["Activite")? $_post["Activite"]: "";
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);
Echo $NB;
for ($i =1; $i <= $nb; $i + +) {
$info =mysql_fetch_row ($result);
echo "$info [0]
";
}
}
}
According to the moderator adult said changed, wherein in the 1.php single selected activités gymniques option, the above code result output is:
Select N_naps from activage where famille= ' activités gymniques ' 0
I do not know why the query result is 0, I copied and pasted this paragraph into MySQL, found 4 results.
Here is 0, do not know why ...
Reference to the 1 floor xuzuning reply: Wrong!
1. for ($i =0; $i < count ($activite); $i + +) {
I don't see the $activite assignment.
2. $strsql = "Select N_naps from Activage where famille= ' $activite [$i] '"
Should write
$strsql = "Select N_naps f ...
On the 2 floor of the supplement Ah, if you remove the after all, it shows all the n_naps, that is, where the problem is where, but I really can not find out where the wrong ah .... is to write $strsql= "select N_naps from Activage where famille= ' activités gymniques ' or 0 ...
The character é is 2 bytes in the Chinese operating system, and its internal code is related to the character set used