I have had a go at creating some alternating table rows but the code runs correctly but just doesn't provide the alternating rows. I have looked through various tutorials and can't find an answer. So i was hoping someone on here might be able to help me
Code:<?php require_once('databaseconnection.php'); $keywordentered = $_GET['keyword']; echo '<table class="table">'; echo '<tr><th>Order Number</th><th>Part Number</th><th>Part Description</th><th>Order Quantity</th><th>Order Date</th><th>Customer Order Number</th><th>Originally Sold To</th><th>Contact Info</th></tr>'; $color1 = "#00E639"; $color2 = "#0039E6"; $row_count = 0; switch($_GET['type']) { case 'ordernumber': if ($_GET['contains']) { $result = odbc_exec($odbc, "SELECT * FROM orderpartnumbertable WHERE Order_No LIKE '".$keywordentered."%' ORDER BY Order_No ASC"); } else { $result = odbc_exec($odbc, "SELECT * FROM orderpartnumbertable WHERE Order_No LIKE '$keywordentered'" ); } break; case 'partnumber': if ($_GET['contains']) { $result = odbc_exec($odbc, "SELECT * FROM orderpartnumbertable WHERE Part_No LIKE '".$keywordentered."%' ORDER BY Part_No ASC"); } else { $result = odbc_exec($odbc, "SELECT * FROM orderpartnumbertable WHERE Part_No LIKE '$keywordentered'"); } break; case 'accountname': if ($_GET['contains']) { $result = odbc_exec($odbc, "SELECT * FROM orderpartnumbertable WHERE Account_Name LIKE '".$keywordentered."%' ORDER BY Account_Name ASC"); } else $result = odbc_exec($odbc, "SELECT * FROM orderpartnumbertable WHERE Account_Name LIKE '$keywordentered'" ); break; } while (($row = odbc_fetch_array($result)) !== false) { $row_color = ($row_count % 2) ? $color1 : $color2; echo '<tr bgcolor="$row_color">'; echo '<td>' . $row['Order_No'] . '</td>'; echo '<td >' . $row['Part_No'] . '</td>'; echo '<td>' . $row['Part_Description'] . '</td>'; echo '<td>' . $row['Order_Qty'] . '</td>'; $string = $row['Order_Date'] ; $date = $string{6} . "" . $string{7} . "/" . $string{4} . $string{5} . "/" . $string{0} . $string{1} . $string{2} . $string{3} ; echo '<td>' . $date . '</td>'; echo '<td>' . $row['Customer_Order_No'] . '</td>'; echo '<td>' . $row['Account_Name'] . '</td>'; echo '<td><a href="ordersearchdetails.php?fnp_site=' . rawurlencode($row['FNP_Site']) . '& Record_ID='. rawurlencode($row['Record_ID']) . '" class="emaillink">More Info</a>' . '</td>'; echo '</tr>'; $row_count ++; } echo '</table>'; ?>
Thank You





Bookmarks