SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    record diplay according to type

    Hi guys,

    I have a form which has 3 fields.

    1.name
    2.address
    3.type

    name is input field
    address is input filed
    type is drop down list.a,b,c in drop down list.
    when submit the form it will store in database.

    Input record like that:

    name address type
    amit delhi a
    amit delhi b
    amit delhi c
    amit mumbai a
    sumit delhi a


    I wana display this record according to type.

    name address A B C(this is like header)
    amit delhi a b c
    amit mumbai a
    sumit delhi a

    I wana display record in excel this format.

    it would be appreciated if u can help me.

    Thanks
    amit

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    First thing is to have your sql query return all the records in the correct order.

    "select name, address, type from table order by name, address, type"

    Does that get you all your records in the correct order? And does that apply to all the use-cases for name for example (is that a first name or family name, will name contain a mixture of first/last names?)

  3. #3
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <table cellspacing="0" cellpadding="0">
    <tr>
    <td width="355"><table width="100%" border="0" cellpadding="0">
    <tr>
    <td width="18%"><div align="right">Name</div></td>
    <td width="5%">&nbsp;</td>
    <td width="77%"><input type="text" name="name"></td>
    </tr>
    <tr>
    <td><div align="right">Address</div></td>
    <td>&nbsp;</td>
    <td><input type="text" name="name2"></td>
    </tr>
    <tr>
    <td><div align="right">Type</div></td>
    <td>&nbsp;</td>
    <td><select name="type"><option value="A">A<option value="B">B<option value="C">C<option value="D">D</select></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value="submit"></td>
    </tr>
    <tr>
    <td><div align="right"></div></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td height="100"><table border="1" cellpadding="5" cellspacing="0" width="93%">
    <tbody>
    <tr align="left">
    <th width="30%" align="left">NAME</th>
    <th width="23%">Address</th>
    <th width="24%">a</th>
    <th width="23%">b</th>
    <th width="23%">c</th>
    </tr>
    <tr>
    <td valign="top">amit</td>
    <td valign="top">delhi</td>
    <td valign="top">a</td>
    <td valign="top">b</td>
    <td valign="top">c</td>
    </tr>
    <tr>
    <td valign="top">amit</td>
    <td valign="top">mumbai</td>
    <td valign="top"><table cellpadding="5" cellspacing="0">
    </table>
    a</td>
    <td valign="top"><table cellpadding="5" cellspacing="0">
    </table></td>
    <td valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td valign="top">sumit</td>
    <td valign="top">delhi</td>
    <td valign="top">a</td>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
    </tr>
    </tbody>
    </table></td>
    </tr>
    </table>

    display record like this

    If i do query group by name but it doesnot show

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    So what do you want help with, displaying the records or getting them out of the database?

  5. #5
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    displaying the record in excel format

  6. #6
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i thnk u did not get my point cups


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •