
12-06-2004, 09:02 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Apr 2004
Posts: 57
|
|
Any help with this question would be greatly appreciated...
I am pulling data from a database (MySQL) using PHP, and displaying it as an HTML table. Here's what it looks like. The problem, as you can see, is that there are too many records on the page, forcing the user to scroll. Is there any way to fix this, while still showing all the data? Different form elements/combinations maybe?
Even a link to a tutorial or article - if you know of one - would be helpful, and greatly appreciated.
Thanks!
|

12-06-2004, 11:39 PM
|
|
Web Hosting Master
|
|
Join Date: Dec 2002
Posts: 1,300
|
|
Pretty basic stuff
Why dont you just display the data differently?
Instead of cramming it all in one row, come up with your organization scheme and then have php fill in the blanks for you. You will probably not care to show all the data there anyway.. for example:
ID probably is an autoincrement field.. no sense in showing that most likely.
Before you begin, ask yourself what you want your end result to be. Only you know what you will WANT it to look like. Then, come ask how to do it.
__________________
"The only difference between a poor person and a rich person is what they do in their spare time."
"If youth is wasted on the young, then retirement is wasted on the old"
|

12-07-2004, 12:12 AM
|
|
Web Hosting Master
|
|
Join Date: Sep 2002
Location: Illinois
Posts: 2,305
|
|
If user.php shows info for one user than you could display rows verticaly 
__________________
How's my programming? Call 1-800-DEV-NULL
|

12-07-2004, 03:50 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Apr 2004
Posts: 57
|
|
Thanks for the replies. The problem is, I can't think of many other ways to display the data. Here's what I came up with though:
http://chartsetups.com/images/ideal.jpg
Would it be possible to make the stock symbols links and have it output the data to a field below? The field below would be what null said - just displaying the rows vertically. But how do I display rows vertically, and how would I create a link that would react like that?
The problem with doing them all vertically would be the fact that there are - in practice - many more entries than just that, probably somewhere around 10-20 per week.
I guess I know the basics of PHP/MySQL, but finding a way to output to a different format (other than an HTML table as defined on php.net) is something I can't find much information on...
Any ideas?
Thanks!
|

12-10-2004, 08:51 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Apr 2004
Posts: 57
|
|
Anyone have any idea of what to do here?
|

12-10-2004, 09:32 PM
|
|
Community Liaison
|
|
Join Date: Apr 2003
Location: London, UK
Posts: 2,959
|
|
Bear in mind that your data is seperate from your HTML, so there's not really any limits to how you can display it on the page, as a paragraph, a list, a table anything you like.
You can also split the array of data you have using something like list() (see: www.php.net/list) so you could then display the output in sections, or seperate tables.
Last edited by Loon; 12-10-2004 at 09:36 PM.
|

12-10-2004, 10:08 PM
|
|
Web Hosting Master
|
|
Join Date: Dec 2002
Posts: 1,300
|
|
Oreilly's mysql cookbook has some fabulous examples of presenting this data in different ways.
Here is a thought:
Grab all the data from the DB as an array, then create an HTML template for your site. Populate the template using php's string functions like str_replace.
Good luck with your project!
__________________
"The only difference between a poor person and a rich person is what they do in their spare time."
"If youth is wasted on the young, then retirement is wasted on the old"
|

12-11-2004, 12:41 PM
|
|
WHT Addict
|
|
Join Date: Apr 2002
Location: USA
Posts: 117
|
|
You could just place the output to multiple tables...
<html>
<head><title>Page title</title></head>
<body>
<?php
$database="databasename";
mysql_connect ("localhost", "user", "passwd");
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query( "SELECT Company_Name, Ticker_Symbol FROM dbtable" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
?>
<?php
$database="databasename";
mysql_connect ("localhost", "user", "passwd");
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query( "SELECT Entry_Price, Exit_Price, Target_Price FROM dbtable" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
?>
</body>
</html>
|

12-11-2004, 09:07 PM
|
|
Junior Guru Wannabe
|
|
Join Date: Apr 2004
Posts: 57
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|