Why can't we find the structure and data of the data table "Product" in this nested query: PHPcodeinclude_once ('Conn. php '); $ result = mysql_query (& quot; SELECTp_classFROMProductgroupbyp _: why can't data be found?
Structure and data of the data table "Product:
PHP code
Include_once ('Conn. php '); $ result = mysql_query ("SELECT p_class FROM Product group by p_class limit 40"); // For the first query, the data mysql_data_seek ($ result, 0) is successfully obtained ); while ($ row = mysql_fetch_row ($ result) {for ($ I = 0; $ I
The code above indicates that the number of loops is correct. the first query is correct, that is, the second query has no data.
------ Solution --------------------
You $ row = in while and then $ row = .... change the 2nd $ row to $ row2 = to be consistent with the subsequent values. let's change it first. I haven't checked your code carefully.
------ Solution --------------------
This is the same as your problem.
Mysql_fetch_row
Change to mysql_fetch_assoc ()
Generally, we return the associated array.
------ Solution --------------------
You are using
Join array
Echo $ row ['Pic ']; // no data found here
Echo $ row ['p _ class']; // same as above
Echo $ row ['p _ name']; // same as above
So you have to return the joined array to match the number... If you do not understand it, you can check the structure of the returned result print_r.
Generally, the returned results are associated arrays, which makes it easier to write code. this is not to say that it is only recommended. it depends on the actual situation. In most cases, we need to use more correlated arrays. of course, you can also use mysql_fetch_array to return two formats ....