How to display line breaks after select and group

Source: Internet
Author: User
After select and group, how to display PHPcode $ result = mysql_query (& quot; SELECT * FROMProductgroupbyp_classlimit40 & quot;); while ($ row = mysq select and group)
PHP code
  $result = mysql_query("SELECT * FROM Product group by p_class limit 40");while($row = mysql_fetch_array($result)){ echo nl2br($row['p_class']); }


The result is to display p_class directly one by one to all rows.

My goal is that each different p_class should have its own column.

Remember to use loops in ASP:

[Code = ASP] <%
Dim iiii

Iiii = 1

Do while not rs2.eof


%>

<% = Iiii %>
<% = Rs2 ("AB _jkdw") %>

<%
Rs2.movenext
Iiii = iiii + 1
Loop
%>



<%
Call rs2close ()
Call connclose ()

%> [/Code]

I still don't know how to write in PHP. please recommend it. thank you!

------ Solution --------------------
What does this mean?

PHP code
Echo'
  
   
'; Echo'
   
     
'; While ($ row = mysql_fetch_array ($ result) {echo"
     ";} Echo'
    '; Echo'
   
$ Row ['p _ class']
';
------ Solution --------------------
Discussion

Is there a pointer like this in php? after checking the loop writing method, it seems that there is still a lack of pointer cooperation

------ Solution --------------------
Echo"". Nl2br ($ row ['p _ class'])."";
------ Solution --------------------
Syntax error

Because you have other functions in it, you have to change it like this.
Echo"". Nl2br ($ row ['p _ class'])."";

The above syntax error is because $ row ['p _ class'] is written as {$ row ['p _ class']}

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.