Jump to content

horizontal rule


searls03

Recommended Posts

how can I basically put a horizontal rule between each entry on this code.......?

<?php
if (isset($_POST['submitted'])) {
include('connect1.php');
$category = $_POST['category'];
$criteria = $_POST['criteria'] ;
$query = "SELECT * FROM members WHERE $category LIKE '%".$criteria."%'";
$result = mysqli_query($dbcon, $query) or die('error getting data');
$num_rows = mysqli_num_rows($result);
echo "$num_rows results found";
echo "<table width=\"896\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr bgcolor=\"#F7E496\"><td bgcolor=\"#F7E496\"><strong>User ID</strong></td> <td bgcolor=\"#F7E496\"><strong>Name</strong></td> <td bgcolor=\"#F7E496\"><strong>email</strong></td> <td  bgcolor=\"#F7E496\"><strong>City</strong></td><td bgclor=\"#F7E496\"></td></tr>";
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "<tr><td>";
echo $row['userid'];
echo "</td><td>";
echo $row['name'];
echo "</td><td>";
echo $row['email'];
echo "</td><td>";
echo $row['city'];
echo "</td><td>";
echo "<form action='admin.php' method='get'><input type='hidden' name='edit'><input type='hidden' name='id' value='{$row['userid']}'><INPUT TYPE='submit' name='submit' VALUE='Edit'></form>\n";
echo "</td><td>";
echo "<form action='delete_account.php' method='get'><input type='hidden' name='userid' value='{$row['userid']}'><INPUT TYPE='submit' name='submit' VALUE='Delete'></form>\n";

echo "</td></tr>";
}
echo "</table>";

}
?>

 

basically each time the code is shown is an entry......

Link to comment
https://forums.phpfreaks.com/topic/231361-horizontal-rule/
Share on other sites

This is a generalized way of alternating colors:

<?php
$color = 'white'; //starting color
$x = 0;
$testing = 'the quick brown fox jumped over the lazy dog';
while ($x < 10) {
   echo "<span style='color:$color'>$testing</span><br>";
   $color = ($color == 'white')?'grey':'white';
   $x++;
}
?>

 

Now just adapt this code to your code... :)

 

Ken

 

Link to comment
https://forums.phpfreaks.com/topic/231361-horizontal-rule/#findComment-1190723
Share on other sites

This is a generalized way of alternating colors:

<?php
$color = 'white'; //starting color
$x = 0;
$testing = 'the quick brown fox jumped over the lazy dog';
while ($x < 10) {
   echo "<span style='color:$color'>$testing</span><br>";
   $color = ($color == 'white')?'grey':'white';
   $x++;
}
?>

 

Now just adapt this code to your code... :)

 

Ken

 

ok so where would I put what from my query?

Link to comment
https://forums.phpfreaks.com/topic/231361-horizontal-rule/#findComment-1191461
Share on other sites

<?php
$color = 'white'; //before your while loop
$x = 0; //not need
$testing = 'the quick brown fox jumped over the lazy dog';//not need
while ($x < 10) {
   echo "<span style='color:$color'>$testing</span><br>"; //inside your while loop
                                                          //add style='background-color:$color;'
                                                          // to <tr> tag
   $color = ($color == 'white')?'grey':'white';//inside while loop
   $x++;//not need
}
?>

Link to comment
https://forums.phpfreaks.com/topic/231361-horizontal-rule/#findComment-1193416
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.