" . $query_title; // echo $query . '::'; $resource=mysql_query($query); if($resource) { $i=0; while($row=mysql_fetch_array($resource)) { //fetch owner info $owner=$row['ownerId']; $query_owner="SELECT * FROM Users WHERE studentId=$owner"; $resource2=mysql_query($query_owner); if($resource2) { $row2=mysql_fetch_array($resource2); $addClass = ""; $i++; if ($i%2==0) $addClass = " color2"; //alternate colors in display $newcode = "<div class='item$addClass'>" . generateListing_S($row['ISBN'], mappedTitle($row['ISBN']), $row['price'], $row['post'], $row['descr'], $row2['email'], $row2['studentId'], $row2['firstName'], $row2['lastName']); echo $newcode; ?> <form action="util/trackBook.php" method="post"> <input type="hidden" name='list_id' value=<? echo '"' . $row['listingId'] . '"' ?> /> <input type="hidden" name='oper' value='1' /> <input type="submit" value="Track" class="track"/> </form></div> <? } } } // $resource=mysql_query($query_title);
</table> <?php require_once "util/listing.php"; $query = "SELECT * FROM Listings WHERE ownerId='{$id}'"; $resource = mysql_query($query); if (!$resource) { echo 'Error: ' . mysql_error(); } echo '<hr class="title-line"/>'; $i = 0; // this code is similar to that in browse.php and trackedBooks. One day we should make a function that does it while ($row = mysql_fetch_array($resource)) { $addClass = ""; $i++; if ($i % 2 == 0) { $addClass = " color2"; } //alternate colors in display $newcode = "<div class='item{$addClass}'>" . generateListing($row['ISBN'], mappedTitle($row['ISBN']), $row['price'], $row['post'], $row['descr']) . "</div>"; echo $newcode; } ?> <? require("util/footer.php"); ?> </body> </html> <!-- Authors: Derek Leung Project BellBook - 1.0 Bellarmine College Preparatory, 2011 -->
$i=0; while($row=mysql_fetch_array($resource)) { $listId=$row['listingId']; $tr_query="SELECT * FROM Listings WHERE listingId=$listId"; $tr_rsrc=mysql_query($tr_query); if($tr_rsrc) { while($tr_row=mysql_fetch_array($tr_rsrc)) { $owner=$tr_row['ownerId']; $owner_query="SELECT * FROM Users WHERE studentId=$owner"; $own_rsrc=mysql_query($owner_query); if($own_rsrc) { $own_row=mysql_fetch_array($own_rsrc); $addClass = ""; $i++; if ($i%2==0) $addClass = " color2"; //alternate colors in display $newcode = "<div class='item$addClass'>" . generateListing_S($tr_row['ISBN'], mappedTitle($tr_row['ISBN']), $tr_row['price'], $tr_row['post'], $tr_row['descr'], $own_row['email'], $row2['studentId'], $own_row['firstName'], $own_row['lastName']); echo $newcode; ?> <form action="util/trackBook.php" method="post"> <input type="hidden" name='list_id' value=<? echo '"' . $row['listingId'] . '"' ?> /> <input type="hidden" name='oper' value='0' /> <input type="submit" value="Remove" class="remove"/> </form> </div> <!-- end item --> <? } //end if } //end while