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.
Sun 07/09/03 at 22:59
Regular
"Chavez, just hush.."
Posts: 11,080
Oh, I forgot about that.

I think I found something earlier on, just gotta test it out now.
Sun 07/09/03 at 22:27
Regular
"Eff, you see, kay?"
Posts: 14,156
There are lots of ways to grab and format data from a database. You can't really ask someone to do it for you, just read examples of code, get some skills and figure it out yourself.
Sun 07/09/03 at 20:31
Regular
"Chavez, just hush.."
Posts: 11,080

$db = mysql_connect("localhost", "o", "o");

mysql_select_db("o",$db);

$result = mysql_query( "SELECT * FROM news 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 "\n";

print "\n";

print "\n";

print "\n";

print "\n";

print "
Subject: $a_row[subject]

Post ID: $a_row[id]

Date: $a_row[date]


size=2>".nl2br($a_row

[text])."
\n";

print "
\n";

}

mysql_close($db);



?>

I've got this at the moment.

I can't see how it would combine as yours is different.

Hmmmmmmmmmmmmmmmmmmmmmmmmmmmm.
Sun 07/09/03 at 20:26
Regular
"Chavez, just hush.."
Posts: 11,080
OK, thanks.

Now I've gotta work out how to combine that with what I've got!
Sun 07/09/03 at 20:10
Regular
"Eff, you see, kay?"
Posts: 14,156

$user = "";
$pass = "";
$host = "";
$dbase = "";

$tablename = "";

mysql_connect($host, $user, $pass);
mysql_select_db($dbase);

?>

$query = mysql_query("select * from $tablename");
$info = mysql_fetch_object($query);
echo "";
foreach ($info as $key=>$value) {
?>

}
echo "";
foreach ($info as $key=>$value) {
?>

}
echo "";
while ($info = mysql_fetch_object($query)) {
echo "";
foreach ($info as $key=>$value) {
?>

}
echo "";
}
echo "
";
// you fear my code.
?>
Sun 07/09/03 at 19:44
Regular
"Chavez, just hush.."
Posts: 11,080
How would I disable HTML/PHP from being processed by the server when it calls the data up/submits it to/from the MySQL database?

I've had a quick look on the net and I can't find anything, I'm gonna look a bit more. I'll post back if I find anything that works.
Sat 30/08/03 at 17:04
Regular
"Chavez, just hush.."
Posts: 11,080
Excellent.

I've managed to do the edit script now!

So I think I've managed to master the basics of MySQL now. My next task is to make that football site run off of MySQL so that matches can be searched etc etc.

Lots to do but it shouldn't be too bad, it's just basically a lot of entering, viewing and editing of data...
Thu 28/08/03 at 14:05
Regular
"Chavez, just hush.."
Posts: 11,080
The link must have been broken for ages, still nobody tells me until today! You're the second person to point it to me today!

Must change that!
Thu 28/08/03 at 14:00
Regular
"It goes so quickly"
Posts: 4,083
phi11ip wrote:
> So thanks for helping with that. My next task is to work out how to
> call records from the database and edit them, although that shouldn't
> be too hard.

Just a little pointer ... look into replacing SELECT with UPDATE when you make the MySQL Query.
Thu 28/08/03 at 13:59
Regular
"It goes so quickly"
Posts: 4,083
Just to let you know, at the footer of each of your pages where you have:

"Site designed by me, if you want stuff, ask me. If you want something like a video, take it. Just host it elsewhere!"

The link for the 'ask me' text contains 'index.php' twice. Hense the 404 when you click it (nice 404 BTW).

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Continue this excellent work...
Brilliant! As usual the careful and intuitive production that Freeola puts into everything it sets out to do, I am delighted.
Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.

View More Reviews

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

Go to Support Centre
Feedback Close Feedback

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.