Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Outputting a table from MySql database


  • Please log in to reply

#1
TheWern

TheWern

    Member

  • Member
  • PipPip
  • 82 posts
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? ? ?
  • 0

Advertisements


#2
ditto

ditto

    - i pwn n00bs -

  • Member
  • PipPipPipPip
  • 1,260 posts
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.thescript...ases/index.html
  • 0

#3
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts
I normally do something like this, it is a bit different that that shown in ditto's link

$result = mysql_query("SELECT col FROM table") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
	$col = $row['col'];
	//do something with $col
}

  • 0

#4
TheWern

TheWern

    Member

  • Topic Starter
  • Member
  • PipPip
  • 82 posts
Thanks for that Guys - I have it sorted now.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP