Jump to content

[SOLVED] math ordering numbers


Jiraiya

Recommended Posts

<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

 

<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>

 

 

 

 

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>

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>

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>


 

 

<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>


 

  • 2 weeks later...

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.