PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1854
Number of posts: 5039

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to create listview in a web page? Posted by nicolemorfs on 6 Mar 2011 at 9:10 AM
This is my first time to make a web page . I'm using PHP and Mysql database. I've already connected the database, and creating the table. Here's the code:

Database Connection:


1	<?php
2	mysql_connect("localhost", "root") or die(mysql_error());
3	echo "Connected to MySQL<br />";
4	?>


Creating Table:

01	<?php
02	 
03	mysql_connect("localhost",  "root") or die(mysql_error());
04	mysql_select_db("Stud_Info") or die(mysql_error());
05	 
06	mysql_query("CREATE TABLE Student_Info(
07	id INT NOT NULL AUTO_INCREMENT,
08	PRIMARY KEY(id),
09	 name VARCHAR(30),
10	 age INT)")
11	 or die(mysql_error()); 
12	 
13	echo "Table Created!";
14	 
15	?>


I want the information will show to the web page by using list view or data grid . But my problem is code of that. I try to find many codes but i didn't make it ..

Can you share me some of your codes or just guide me on how to do it. please......

it is my Pleasure ... Thanks... :D 











______________________________________________________________


Plumber Columbia SC
Lexington SC Plumber

Report
Re: How to create listview in a web page? Posted by pseudocoder on 16 Mar 2011 at 11:32 PM


One thing you might try is using a scrolling div within a table

<table>
   <th>ID</th><th>Name</th><th>Age</th>
   <tr>
      <td>
         <div style="height: 110px; overflow: auto">
            <table>
               <?php
                  $res = mysql_query("select * from Student_Info");
                  if(mysql_num_rows($res) > 0) {
                     while($row = mysql_fetch_assoc($res)) {
                        echo "<tr>" .
                             "<td>" . $row['id'] . "</td>" .
                             "<td>" . $row['name'] . "</td>" .
                             "<td>" . $row['age'] . "</td></tr>";
                     }
                  }
               ?>
            </table>
         </div>
      </td>
   </tr>
</table>


It's super late for me, but hopefully it's valid code... my eyeballs are blurry. :D I didn't do any formatting of the table(s), but maybe something like that.






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.