hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Some PHP Questions...
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Some PHP Questions...

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 12-06-2004, 09:02 PM
devanium devanium is offline
Junior Guru Wannabe
 
Join Date: Apr 2004
Posts: 57

Some PHP Questions...


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!

Reply With Quote


Sponsored Links
  #2  
Old 12-06-2004, 11:39 PM
innova innova is offline
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"

Reply With Quote
  #3  
Old 12-07-2004, 12:12 AM
null null is offline
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

Reply With Quote
Sponsored Links
  #4  
Old 12-07-2004, 03:50 AM
devanium devanium is offline
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!

Reply With Quote
  #5  
Old 12-10-2004, 08:51 PM
devanium devanium is offline
Junior Guru Wannabe
 
Join Date: Apr 2004
Posts: 57
Anyone have any idea of what to do here?

Reply With Quote
  #6  
Old 12-10-2004, 09:32 PM
Loon Loon is offline
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.
Reply With Quote
  #7  
Old 12-10-2004, 10:08 PM
innova innova is offline
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"

Reply With Quote
  #8  
Old 12-11-2004, 12:41 PM
sonic10 sonic10 is offline
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>

Reply With Quote
  #9  
Old 12-11-2004, 09:07 PM
devanium devanium is offline
Junior Guru Wannabe
 
Join Date: Apr 2004
Posts: 57
Thanks for the replies!

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Who Wants to be a Hosting Millionaire? with Jack Zubarev Web Hosting News 2013-02-06 20:01:39
The Human Side of Hosting, with SimplyServers Web Hosting News 2011-10-25 18:46:10
GlowTouch CSO Michael Fountain Gives Blueprint for Turning Ideas into Products Web Hosting News 2011-08-10 23:29:24
Endurance's Joe Bardenheier Discusses The Ins and Outs of M&A Web Hosting News 2011-08-08 23:10:44
Submit Your Questions for Liam Eagle’s Q&A Panel of Hosting Leaders Web Hosting News 2011-07-12 13:42:48


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?