All pastes #178165 Raw Edit

Miscellany

public text v1 · immutable
#178165 ·published 2006-09-21 01:38 UTC
rendered paste body
<style type="text/css">
<!--
.textStyle {
			font-family: Arial;
			}
.priceStyle {
			color: #FF0000;
			font-family: Arial;
			}
.commentStyle {
			font-family: Arial;
			font-size: 12px;
			}
.titleStyle {font-family: Arial;}
				
-->
</style>


<table width="100%"  border="0" bgcolor="#EDEBED">
  <tr>
    <td width="8%"><div align="center"><a href="index.php">[Home]</a></div></td>
    <td width="68%"><div align="right"><a href="addbook.php">[Add Book]</a> </div></td>
    <td width="7%"><div align="center"><a href="gallery/">[Gallery]</a></div></td>
    <td width="7%"><div align="center"><a href="chat/">[Chat]</a></div></td>
    <td width="10%"><a href="forum/">[Forum]</a></td>
  </tr>
</table>
<table width="100%"  border="0">
  <tr>
    <td width="44%"><img src="images/sb.png" alt="Stony Brook University"></td>
    <td width="25%">&nbsp;</td>
    <td width="31%"><div align="right"></div>
    <?php include_once("weather.php"); ?></td>
  </tr>
</table>
<br>
<table align="center" bgcolor="#dd9988" border="0" cellpadding="1" cellspacing="0" width="90%">
  <tbody>
    <tr>
      <td height="75"><table border="0" cellpadding="8" cellspacing="0" width="100%">
          <tbody>
            <tr>
              <td class="small" bgcolor="#ffffd5"> <b class="sans"><font color="#990000">Important Message</font></b> <br>
                  <font color="#990000">Eliminate the middle man, save money and make money. Instead of selling books to the bookstore, sell to your friends; this way you make more money and help your friend save money.</font></td>
            </tr>
          </tbody>
      </table></td>
    </tr>
  </tbody>
</table> <br>


<form method="GET" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="text" name="class">
<input type="submit" value="Submit">
</form>
<table width="100%"  border="0" cellpadding="1" cellspacing="0">
  <tr align="center" bgcolor="#CCCCCC">
    <td width="10%"><span class="titleStyle">Class</span></td>
    <td width="15%"><span class="titleStyle">Title</span></td>
    <td width="15%"><span class="titleStyle">Author</span></td>
    <td width="10%"><span class="titleStyle">ISBN</span></td>
    <td width="10%"><span class="titleStyle">Price</span></td>
    <td width="25%"><span class="titleStyle">Comment</span></td>
    <td width="15%"><span class="titleStyle">Contact</span></td>
  </tr>
<?php
$class = $_GET['class'];
$class = str_replace(array(" ","\n","\t","\r"),'',$class);
$class = addslashes(strtoupper($class));

$link = mysqli_connect(
            'localhost',  
            '',       
            'v',   
            '');    

if (!$link) {
   printf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error());
   exit;
}

if ($result = mysqli_query($link, "SELECT * 
									FROM `book_books`
									WHERE book_class='$class'
									ORDER BY book_price ASC")) {

    while( $row = mysqli_fetch_object($result) ){
?>

  <tr align="center" bgcolor="#E2E2E2">
    <td width="12%"><span class="textStyle"><?php echo"$row->book_class"; ?></span></td>
    <td width="16%"><span class="textStyle"><?php echo"$row->book_title"; ?></span></td>
    <td width="12%"><span class="textStyle"><?php echo"$row->book_author"; ?></span></td>
    <td width="8%"><span class="textStyle"><?php echo"$row->book_isbn"; ?></span></td>
    <td width="6%"><span class="priceStyle"><?php echo"$row->book_price"; ?></span></td>
    <td width="26%"><span class="commentStyle"><?php echo"$row->book_comment"; ?></span></td>
    <td width="20%"><span class="commentStyle"><?php echo"$row->book_contact"; ?></span></td>
  </tr>


<?php
    }
    mysqli_free_result($result);
}
else if (empty($class)) {

$result = mysqli_query($link, "SELECT * 
									FROM `book_books`
									ORDER BY book_price ASC
                                                                        LIMIT 10")) {

    while( $row = mysqli_fetch_object($result) ){
?>

  <tr align="center" bgcolor="#E2E2E2">
    <td width="12%"><span class="textStyle"><?php echo"$row->book_class"; ?></span></td>
    <td width="16%"><span class="textStyle"><?php echo"$row->book_title"; ?></span></td>
    <td width="12%"><span class="textStyle"><?php echo"$row->book_author"; ?></span></td>
    <td width="8%"><span class="textStyle"><?php echo"$row->book_isbn"; ?></span></td>
    <td width="6%"><span class="priceStyle"><?php echo"$row->book_price"; ?></span></td>
    <td width="26%"><span class="commentStyle"><?php echo"$row->book_comment"; ?></span></td>
    <td width="20%"><span class="commentStyle"><?php echo"$row->book_contact"; ?></span></td>
  </tr>


<?php
    }
    mysqli_free_result($result);
}
mysqli_close($link);
?> 
</table>