GetDotted Domains

Viewing Thread:
"MySQL - Displaying data in a table..."

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Fri 22/08/03 at 16:57
Regular
Posts: 787
There you go Mod.

Just as you asked!

Anyway.

Does anyone know about MySQL and displaying the data in a table?

I've got a basic script to display it like this (http://www.phi11ip.com/mysql/display.php) but I want to be able to display it out of the rows and something like it shows at the bottom of the page...

Does anybody know how to do anything like this? If you can give me the general idea of what to do with a small example or a link to one I should be able to modify it and get it working...

Thanks.
Sat 23/08/03 at 14:13
Regular
"Chavez, just hush.."
Posts: 11,080
OK, I'll give it a try!

It's always really really easy, and I can never work it out!
Sat 23/08/03 at 12:06
Regular
"It goes so quickly"
Posts: 4,083
I take it you mean using the nl2br(); function on the information grabbed from the database?

If so, try:
print " ".nl2br($a_row[a_field_name])." \n";

or:
print "";
print nl2br($a_row[a_field_name]);
print "
\n";
Fri 22/08/03 at 23:09
Regular
"Chavez, just hush.."
Posts: 11,080
Next question.

Here is the code that I use to display the text.

----

$result = mysql_query( "SELECT * FROM text ORDER BY id DESC LIMIT 7;" )

or die("SELECT Error: ".mysql_error());

# Loop through each row of data.

while ($a_row = mysql_fetch_array($result)) {

PRINT STUFF

----

This is the main part of it, I've found that I need to use this $text = nl2br($text) to get it to show line breaks correctly.

I know I've gotta change the variables (to something) but I don't know where to put it, or do I have to put it in when I submit the data?

Thanks.
Fri 22/08/03 at 21:30
Regular
"Chavez, just hush.."
Posts: 11,080
Don't worry. (Not that you were!)

I've fixed it now.
Fri 22/08/03 at 18:13
Regular
"Chavez, just hush.."
Posts: 11,080
How do you set a field to have an unlimited size?

The max I can get is 255 characters.
Fri 22/08/03 at 18:00
Regular
"Chavez, just hush.."
Posts: 11,080
I think I've got on the way now to getting what I want.

http://www.phi11ip.com/mysql/display3.php

Plus, what does ÷ do? ÷÷÷÷÷÷÷÷÷ why can't I do that combination?

\t

There, that.

What does it do?
Fri 22/08/03 at 17:48
Regular
"It goes so quickly"
Posts: 4,083
mysql_fetch_array makes placment of the data a lot easier.

Good luck.
Fri 22/08/03 at 17:46
Regular
"Chavez, just hush.."
Posts: 11,080
Ahhhhhhhhhhhhh.

I might be able to get somewhere now!
Fri 22/08/03 at 17:41
Regular
"Chavez, just hush.."
Posts: 11,080
I can see faintly what I have to do now...

I'll have a go and see...
Fri 22/08/03 at 17:38
Regular
"Chavez, just hush.."
Posts: 11,080
$result = mysql_query( "SELECT * FROM text ORDER BY id DESC LIMIT 3;" )

or die("SELECT Error: ".mysql_error());

$num_rows = mysql_num_rows($result);

print "There are $num_rows records.

";

print "

\n";

while ($get_info = mysql_fetch_row($result)){

print "\n";

foreach ($get_info as $field)

print "\t\n";

print "\n";

}

print "
$field
\n";

mysql_close($db);



?>


At the moment it's this. (minus the top)

I want to change the way it displays the data, change the layout of the table...

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Many thanks!
You were 100% right - great support!
Second to none...
So far the services you provide are second to none. Keep up the good work.
Andy

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.