Jump to content

ORDER BY..... and tables


moria123

Recommended Posts

I have the following code....

 

<html>

<title>Releases</title

<?php

$db = mysql_connect("localhost", "XXXX", "XXXXX");



mysql_select_db("XXXXXX" ,$db);





$title = "Mazza\'s Place";



$result = mysql_query("SELECT * FROM releases ORDER BY game", $db);



echo "Release Dates";

echo "<table border=1>n";



echo "<tr><td><b>Game Title</b></td><td><b>Format</b></td><td><b>Developer</b></td><td><b>Release Date</b></td></tr>n";



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



 printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>n", $myrow[1], $myrow[3], $myrow[4], $myrow[2]);



}



echo "</table>n";

?>

</html>

 

When I view it (www.mazzas-place.com/nuke/modules/Releases/index2.php) it just comes out as plain text, not in a table.... But when I take the ORDER BY thing out, it works fine... (www.mazzas-place.com/nuke/modules.php?name=Releases).

 

How do I get the first one to go into a table? Thanks

Link to comment
https://forums.phpfreaks.com/topic/1402-order-by-and-tables/
Share on other sites

Have you tried \"ORDER BY game ASC\" ? That will put it in alphabetical order, and it might be going swcrewy because you don\'t have that.

 

You do a lot of echoing. If my previous suggestion doesn\'t work, try the table outside of PHP, and using <?=$variable?> to call the variables.

Link to comment
https://forums.phpfreaks.com/topic/1402-order-by-and-tables/#findComment-4657
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.