一些PHP嵌入HTML中语法约定报错的问题
认真排版了一下HTML,然后慢慢填空,总算把之前发了两个帖子问关于嵌套循环查询的问题解决了。
但是,新问题出现,语法写得不正确,标注出来了,麻烦大家指教一下:
<?phpinclude_once('conn.php');$result = mysql_query("SELECT p_class FROM Product group by p_class limit 40"); mysql_data_seek($result, 0); while ($row=mysql_fetch_row($result)) { for ($i=0; $i<mysql_num_fields($result); $i++ ) {?><table border="1"> <tr> <td><?php echo "$row[$i]";?></td> <td>more</td> </tr> <tr> <td colspan="2">********</td> </tr></table> <table border="1"> <tr><?php$result2 = mysql_query("SELECT * FROM Product where p_class=$row[$i] limit 0,4"); while ($row=mysql_fetch_row($result2)) { ?> <td> <table border="1"> <tr><td> <img src=<?php echo $row['pic'];?> />//这里报错,说写法不对 </td></tr> <tr><td> <?php echo $row['p_class'];?>//这里报错,说写法不对 </td></tr> <tr><td> <?php echo $row['p_name'];?>//这里报错,说写法不对 </td></tr> </table> <br /> </td> <?php }?> </tr></table><?php } } mysql_free_result($result);mysql_free_result($result2);mysql_close($conn);?>