All pastes #478764 Raw Edit

Something

public php v1 · immutable
·published 2007-05-09 11:13 UTC
rendered paste body
<?php// -----------------------------// DISPLAY QUOTES FROM CONTACT// -----------------------------$color1 = "#F5F9FE";$color2 = "#ECF1FD";function list_quotes($field, $value) {// prints start of tableecho "  <table width=100% bgcolor=#F9F9F9 align=center border=0 cellpadding=2 cellspacing=0>  <tr>    <td colspan=5><div class=header3a>Opportunities:</div></td>  <tr>  <tr bgcolor=$color1>    <td width=10% class=list_title><b>Name</b></td>    <td width=20% class=list_title><b>Contact</b></td>    <td width=20% class=list_title><b>Board Ref</b></td>    <td width=30% class=list_title><b>Board Num</b></td>    <td width=20% class=list_title><b>Status</b></td>  </tr>";// form the query for selecting info of each contact from the seleced accountsinclude("db_connect.php");$query="SELECT o.*, c.first_name, c.last_name, p.name AS product_name, s.name AS status_name FROM opportunities o        LEFT JOIN contacts c ON o.contact_id = c.id        LEFT JOIN product_types p ON o.product_id = p.id        LEFT JOIN status_types s ON o.status_id = s.id        WHERE $field=$value ORDER BY name DESC";$result=mysql_query($query) or die(mysql_error());mysql_close();// loop through all quotes and list data$i = 0;while ($row = mysql_fetch_assoc($result)) {  $id = $row['id'];  $name = $row['name'];  $first_name = $row['first_name'];  $last_name = $row['last_name'];  $full_name = $first_name.' '.$last_name;  $board_ref = $row['board_ref'];  $board_num = $row['board_num'];  $status_name = $row['status_name'];    $row_color = ($i % 2) ? $color1 : $color2;    echo "    <tr bgcolor=$row_color>      <td class=list_item><a href=quote_details.php?quote_id=$id>$name</a></td>      <td class=list_item>$full_name</td>      <td class=list_item>$board_ref</td>      <td class=list_item>$board_num</td>      <td class=list_item>$status_name</td>    </tr>";  $i++;  }// ends tableecho "</table>";}?>