Jump to content

Is there an easy way to include a row count?


aaricwon

Recommended Posts


<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<p align="center"><img src="imgs/world-bar.png" width="770" height="59" />
<form name="form" action="<?php echo(htmlentities($_SERVER['PHP_SELF'])); ?>" method="get">
  <div align="center">
    <p><a href="form.html" class="style1">Report a Problem Order</a></p>
    <?
  include 'search.php';
  ?>
    </p>
  </div>
</form>
<p align="center">Sort by: <a href="displaytable_date.php">Date</a>, <a href="displaytable_oracle.php">Oracle Order</a>, <a href="displaytable_customer.php">Customer</a>
, <a href="displaytable_who.php">Reported by</a><br>Edit/Update Info: <a href="http://www.bjjnews.org/problems/updates.php">Edit Problem Orders</a> , <a href="http://www.bjjnews.org/problems/delete.php">Delete Problem Orders</a>
<div align=center><strong><p>Sorted by: <u>DATE</u></strong><p></div>
    <?php


  If($PAGE_RESULT != null && $search != NULL && $search != '%'){
echo($PAGE_RESULT);
}else{

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');

$dbname = 'bjjnews_problemorders';
mysql_select_db($dbname);

$query  = "SELECT * FROM problems1 ORDER BY field_6 ASC";
$result = mysql_query($query);

echo "<table border='1' cellspacing='0'>
<tr>
<th bgcolor='FFFFCC'>Oracle Order</th>
<th bgcolor='FFFFCC'>Customer</th>
<th bgcolor='FFFFCC'>Customer PO</th>
<th bgcolor='FFFFCC'>Problem</th>
<th bgcolor='FFFFCC'>Reported by</th>
<th bgcolor='FFFFCC'>Date</th>
<th bgcolor='FFFFCC'>Status</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr bgcolor='CCCCCC'>";
  echo "<td>" . $row['field_1'] . "</td>";
  echo "<td>" . $row['field_2'] . "</td>";
    echo "<td>" . $row['field_3'] . "</td>";
  echo "<td>" . $row['field_4'] . "</td>";
    echo "<td>" . $row['field_5'] . "</td>";
  echo "<td>" . $row['field_6'] . "</td>";
    echo "<td>" . $row['field_7'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
}
?>

[code]

[/code]

Link to comment
Share on other sites

Sha zam zam...

 

change

while($row = mysql_fetch_array($result))
  {
  echo "<tr bgcolor='CCCCCC'>";
  echo "<td>" . $row['field_1'] . "</td>";
  echo "<td>" . $row['field_2'] . "</td>";
    echo "<td>" . $row['field_3'] . "</td>";
  echo "<td>" . $row['field_4'] . "</td>";
    echo "<td>" . $row['field_5'] . "</td>";
  echo "<td>" . $row['field_6'] . "</td>";
    echo "<td>" . $row['field_7'] . "</td>";
  echo "</tr>";
  }
echo "</table>";
}

to

$i = 1;
while($row = mysql_fetch_array($result))
  {
  echo "<tr bgcolor='CCCCCC'>";
  echo "<td>$i</td>";
  echo "<td>" . $row['field_2'] . "</td>";
    echo "<td>" . $row['field_3'] . "</td>";
  echo "<td>" . $row['field_4'] . "</td>";
    echo "<td>" . $row['field_5'] . "</td>";
  echo "<td>" . $row['field_6'] . "</td>";
    echo "<td>" . $row['field_7'] . "</td>";
  echo "</tr>";
$i++;//increment by one
  }
echo "</table>";
}

 

Note I changed the first column to the number. If you still want to retain the id number, you'll need to add a new column.

 

SC

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.