Regarding display of output - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Regarding display of output

s7r1ngss7r1ngs Posts: 19Member
I use php with mysql...

I have 4 entries in a table say c1,c2,c3,c4...

I want to display them in such a way:
c1,c2
c3
c4

I dont know how to do this...

What i used to do is:


$result = mysql_query( "SELECT c1,c2,c3,c4 FROM tablename " )
or die("SELECT Error: ".mysql_error());

$num_rows = mysql_num_rows($result);

while($get_info = mysql_fetch_row($result)
{
foreach($get_info as $field)
$field
}

This displays the output in a manner: c1,c2,c3,c4....
How to get my desired output scheme...>?>?>?



Comments

  • ManningManning Posts: 1,621Member
    : I use php with mysql...
    :
    : I have 4 entries in a table say c1,c2,c3,c4...
    :
    : I want to display them in such a way:
    : c1,c2
    : c3
    : c4
    :
    : I dont know how to do this...
    :
    : What i used to do is:
    :
    :
    : $result = mysql_query( "SELECT c1,c2,c3,c4 FROM tablename " )
    : or die("SELECT Error: ".mysql_error());
    :
    : $num_rows = mysql_num_rows($result);
    :
    : while($get_info = mysql_fetch_row($result)
    : {[red]
    : echo "$get_info[0],$get_info[1]
    $get_info[2]
    $get_info[3]
    ";
    : [/red]}
    :
    : This displays the output in a manner: c1,c2,c3,c4....
    : How to get my desired output scheme...>?>?>?

    Note the changes above.
  • s7r1ngss7r1ngs Posts: 19Member
    Thanks....
    I don't know how this thing slipped from my mind...
    Yah! it worked and worked great
    Thank You very much!
Sign In or Register to comment.