Welcome Guest ( Log In | Join )

Discover the best free computer help!
Learn more about Geeks to Go by taking the tour. Spyware, virus, trojan, fake security or privacy alerts? Read the malware cleaning guide. Want to reply to a topic, start a new one, or remove the advertising? Join today (always free).
 
Reply to this topicStart new topic
Outputting a table from MySql database, Suggestions
TheWern
post May 29 2007, 12:26 AM
Post #1


Member
**
Posts: 50
OS: XP



Hi All,
I have set up a MySql table with 15 cols of various data. Each row then represents a single transaction. There would be up to 25 rows max. The first col will be no's from 0-up to 25, but there may only be eg. 4 rows in the table at the time when they're viewed.

I've tried to create code with loops to retrieve line by line to output to a page with a table built into it. It goes into never-ending loops and I cant seem to find a way to retrieve 'as many' lines are there. I'm sure there is a simple-ish way to do this, but I cant find a working example to study.

Any ideas? ? ?
Go to the top of the page
 
+Quote Post
ditto
post May 29 2007, 10:41 AM
Post #2


- i pwn n00bs -
Group Icon
Posts: 1,258
From: Phila. PA
OS: openSuse, Ubuntu, Fedora, Debian



How are you accessing the data in the mysql database.

I am going to assume that you are using php.

This will give you a place to start.
http://www.thescripts.com/serversidescript...ases/index.html
Go to the top of the page
 
+Quote Post
Michael
post May 31 2007, 06:28 AM
Post #3


Retired Staff
Group Icon
Posts: 1,856
From: Australia
OS: Linux



I normally do something like this, it is a bit different that that shown in ditto's link

CODE
$result = mysql_query("SELECT col FROM table") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
    $col = $row['col'];
    //do something with $col
}
Go to the top of the page
 
+Quote Post
TheWern
post Jun 8 2007, 10:42 AM
Post #4


Member
**
Posts: 50
OS: XP



Thanks for that Guys - I have it sorted now.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies / Views Topic Information
No New Posts   1 / 952 18th August 2006 - 11:52 PM
TomPainter started - last by dsm
No New Posts   9 / 368 2nd February 2007 - 11:54 PM
Wren182 started - last by Michael
No New Posts 3 / 236 20th June 2007 - 06:01 AM
TheWern started - last by Michael
No New Posts   1 / 748 26th May 2008 - 08:57 PM
Diego8 started - last by Diego8

RSS Time is now: 5th December 2008 - 04:51 AM
Advertisements do not imply our endorsement of that product or service. The forum is run by volunteers who donate their time and expertise. We make every attempt to ensure that the help and advice posted is accurate and will not cause harm to your computer. However, we do not guarantee that they are accurate and they are to be used at your own risk.