Jump to content

[SOLVED] im not sure whats wrong with this script


Jiraiya

Recommended Posts


<table border="1">
<tr>
<th>Villag</th>
<th>Health</th>
<th>Skill</th>
<th>Current Hokage</th>

</tr>

<?php
// includes
$host = "localhost";
$user = "username";
$pass = "password";
$db = "databasename";


// open database connection
$connection = mysql_connect(localhost, username, password) or die ("Unable to connect!");

// select database
mysql_select_db(members) or die ("Unable to select database!");

// generate and execute query

$query = "SELECT * FROM townranks  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->townname; ?></td>
     <td><?php echo $row->hp; ?></td>
     <td><?php echo $row->sk; ?></td>
     <td><?php echo $row->kage; ?></td>
  </tr>
<?php
}
}
// if no records present
// display message
else
{
?>
<p>No data available</p>
<?php
}

// close database connection
mysql_close($connection);
?>
</table>

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.