genericnumber1 Posted November 23, 2008 Share Posted November 23, 2008 can you post your FULL script with the error reporting line added? Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696823 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 i dont think he has a connection to the db im gonna write up a code ill brb Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696825 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 <table border="1"> <tr> <th>Name</th> <th>Rank</th> <th>Skill</th> <th>Kekkei Genkai</th> </tr> <?php // includes $host = "HOSTNAME"; $user = "USERNAME"; $pass = "PASSWORD"; $db = "DATABASE NAME"; // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "SELECT * FROM users WHERE skill = '$skill' ORDER BY skill"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // get resultset as object $row = mysql_fetch_object($result); // print details if ($row) { ?> <tr> <td><?php echo $row->username; ?></td> <td><?php echo $row->rank; ?></td> <td><?php echo $row->skill; ?></td> <td><?php echo $row->bloodline; ?></td> </tr> <?php } else { ?> <p> <font size="-1"> could not be located in our database.</font> <?php } // close database connection mysql_close($connection); ?> </table> CHnage the log in details and tell me what this does for you Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696827 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 <html> <head> <title>Naruto: Tales Of The Sannin</title> <center><img src="http://narutotalesofthesannin.com/narutowebbanner1.jpg"> </a> <HR WIDTH="100%"> <body bgcolor=006600> </head> <body> <br> <center><H2>Player Name and Rank</H2> <br> <?php $con = mysql_connect("mysql","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("members", $con); <?php mysql_select_db("members", $con); $query = "SELECT * FROM users ORDER BY skill DESC"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); echo "<table border='1'> <tr> <th>Name</th> <th>Rank</th> <th>Skill</th> <th>Kekkei Genkai</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['username'] . "</td>"; echo "<td>" . $row['rank'] . "</td>"; echo "<td>" . $row['skill'] . "</td>"; echo "<td>" . $row['bloodline'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696832 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 the code you told me to try came up white Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696834 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 first of all <center><img src="http://narutotalesofthesannin.com/narutowebbanner1.jpg"> </a> <HR WIDTH="100%"> <body bgcolor=006600> cant be in the head section otherwise i dont clearly see an error there Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696835 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 there is no way this is coming up blank if you change the host details do you have a link i can view with this code used? <html> <head> <title>Naruto: Tales Of The Sannin</title> </head> <body bgcolor=006600> <center><img src="http://narutotalesofthesannin.com/narutowebbanner1.jpg"> <HR WIDTH="100%"> <br> <center><H2>Player Name and Rank</H2> <br> <table border="1"> <tr> <th>Name</th> <th>Rank</th> <th>Skill</th> <th>Kekkei Genkai</th> </tr> <?php // includes $host = "HOSTNAME"; $user = "USERNAME"; $pass = "PASSWORD"; $db = "DATABASE NAME"; // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "SELECT * FROM users WHERE skill = '$skill' ORDER BY skill"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // get resultset as object $row = mysql_fetch_object($result); // print details if ($row) { ?> <tr> <td><?php echo $row->username; ?></td> <td><?php echo $row->rank; ?></td> <td><?php echo $row->skill; ?></td> <td><?php echo $row->bloodline; ?></td> </tr> <?php } else { ?> <p> <font size="-1"> could not be located in our database.</font> <?php } // close database connection mysql_close($connection); ?> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696837 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 http://narutotalesofthesannin.com/bingobook.php its visible but no data is being displayed Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696841 Share on other sites More sharing options...
genericnumber1 Posted November 23, 2008 Share Posted November 23, 2008 Again, try <?php error_reporting(E_ALL); ?> <html> <head> <title>Naruto: Tales Of The Sannin</title> <center><img src="http://narutotalesofthesannin.com/narutowebbanner1.jpg"> </a> <HR WIDTH="100%"> <body bgcolor=006600> </head> <body> <br> <center><H2>Player Name and Rank</H2> <br> <?php $con = mysql_connect("mysql","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("members", $con); <?php mysql_select_db("members", $con); $query = "SELECT * FROM users ORDER BY skill DESC"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); echo "<table border='1'> <tr> <th>Name</th> <th>Rank</th> <th>Skill</th> <th>Kekkei Genkai</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['username'] . "</td>"; echo "<td>" . $row['rank'] . "</td>"; echo "<td>" . $row['skill'] . "</td>"; echo "<td>" . $row['bloodline'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696842 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 i did nothing changed Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696843 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 theres something with your database then not my code could not be located in our database. is on the page so its not finding any records to display Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696845 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 i had it working before but it wasnt ordering it the way i needed it to Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696846 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 i removed the where try that i have a theory this will get all results ordered by skill <table border="1"> <tr> <th>Name</th> <th>Rank</th> <th>Skill</th> <th>Kekkei Genkai</th> </tr> <?php // includes $host = "HOSTNAME"; $user = "USERNAME"; $pass = "PASSWORD"; $db = "DATABASE NAME"; // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "SELECT * FROM users ORDER BY skill"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // get resultset as object $row = mysql_fetch_object($result); // print details if ($row) { ?> <tr> <td><?php echo $row->username; ?></td> <td><?php echo $row->rank; ?></td> <td><?php echo $row->skill; ?></td> <td><?php echo $row->bloodline; ?></td> </tr> <?php } else { ?> <p> <font size="-1"> could not be located in our database.</font> <?php } // close database connection mysql_close($connection); ?> </table> Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696848 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 its getting there but its only showing one users information Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696850 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 <table border="1"> <tr> <th>Name</th> <th>Rank</th> <th>Skill</th> <th>Kekkei Genkai</th> </tr> <?php // includes $host = "HOSTNAME"; $user = "USERNAME"; $pass = "PASSWORD"; $db = "DATABASE NAME"; // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "SELECT * FROM users ORDER BY skill DESC"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset // print article titles while($row = mysql_fetch_object($result)) { ?> <tr> <td><?php echo $row->username; ?></td> <td><?php echo $row->rank; ?></td> <td><?php echo $row->skill; ?></td> <td><?php echo $row->bloodline; ?></td> </tr> <?php } } // if no records present // display message else { ?> <p>No press releases currently available</p> <?php } // close database connection mysql_close($connection); ?> </table> Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696852 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 its ordering it in the reverse order Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696853 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 hrmm change desc to asc to reverse on the code above your post by me but when i view your page it displays that they all have 1000 in the skill field Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696857 Share on other sites More sharing options...
Jiraiya Posted November 23, 2008 Author Share Posted November 23, 2008 Ok its fixed. thank you a lot for your help Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696864 Share on other sites More sharing options...
dropfaith Posted November 23, 2008 Share Posted November 23, 2008 np Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-696867 Share on other sites More sharing options...
keiran420 Posted December 3, 2008 Share Posted December 3, 2008 damn, more pages >.< argh >.< Link to comment https://forums.phpfreaks.com/topic/133855-solved-math-ordering-numbers/page/2/#findComment-705302 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.