2009-02-27, 03:51 AM
Anyone have an answer for this? It's been a while and was lost in the thread.
(2008-12-15, 09:57 PM)tbanucci Wrote: [ -> ]This code has worked out great for me, with one exception. On my website, I changed all of the pages from HTML to PHP so that you can login from any page. I have a page on my site that was already in PHP, and does not want to co-exist with the PHP code you wrote in the initial post.
Here is the PHP header:
<?php include('_config.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
and later, the code.....
<?php $sql2 = "SELECT * FROM _members WHERE active = 1 ORDER BY company ASC"; $qid2 = db_query($sql2); $limit = db_num_rows($qid2); //$limit--; $randNum = rand(0,$limit); if (db_num_rows($qid2) >= 1) { for ($a2=0; $a2<db_num_rows($qid2); $a2++) { list($id,$firstname,$lastname,$company,$phone,$email,$website) = db_fetch_row($qid2); if ($randNum == $id) { echo '<table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="100%" valign="middle" style="font-size:16px;background-color:#88a6d5;border:2px solid #666;font-size:13px;padding:10px;text-align:center;"> <h2 style="font-size:19px;color:#fff;margin-bottom:6px;">'.$company.'</h2> <strong>'.$firstname.' '.$lastname.'</strong><br> '.$phone.'<br><br>'; if (!empty($email)) { echo '<img src="images/email_med.gif" style="margin-bottom:-3px;"> <a href="mailto:'.$email.'" style="font-size:13px;text-decoration:none;color:#fff;">E-mail</a> '; } if (!empty($website)) { echo '<img src="images/home_med.gif" style="margin-bottom:-3px;"> <a href="http://'.$website.'" target="_blank" style="font-size:13px;text-decoration:none;color:#fff;">Website</a>'; } echo '</tr></td></table>'; } } } ?> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="50%" valign="top" style="font-size:11px;"> <?php $sql = "SELECT * FROM _members WHERE active = 1 ORDER BY company ASC"; $qid = db_query($sql); $howmany = db_num_rows($qid); $half = number_format($howmany / 2); $counter = 0; if (db_num_rows($qid) >= 1) { for ($a=0; $a<db_num_rows($qid); $a++) { list($id,$firstname,$lastname,$company,$phone,$email,$website) = db_fetch_row($qid); echo ' <div style="padding-bottom:12px;border-bottom:1px solid #cccccc;"> <h2 style="font-size:14px;color:#6C8CBF;margin-bottom:6px;">'.$company.'</h2> <strong>'.$firstname.' '.$lastname.'</strong><br> '.$phone.'<br><br>'; if (!empty($email)) { echo '<img src="images/email.gif"> <a href="mailto:'.$email.'" style="font-size:11px;text-decoration:none;color:#666;">E-mail</a> '; } if (!empty($website)) { echo '<img src="images/home.gif"> <a href="http://'.$website.'" target="_blank" style="font-size:11px;text-decoration:none;color:#666;">Website</a>'; } echo '</div>'; $counter++; if ($counter == $half) { echo '</td><td width="20"> </td><td width="50%" valign="top" style="font-size:11px;">'; } } } ?> </td> </tr> </table> <!-- <table width="100%" border="0" cellspacing="0" cellpadding="6"> <tr> <td width="350"><h4>Company Name</h4></td> <td><h4>Name</h4></td> <td><h4>Office</h4></td> <td><h4>Email</h4></td> <td><h4>Website</h4></td> </tr> <?php $sql = "SELECT * FROM _members WHERE active = 1 ORDER BY company ASC"; $qid = db_query($sql); if (db_num_rows($qid) >= 1) { for ($a=0; $a<db_num_rows($qid); $a++) { list($id,$firstname,$lastname,$company,$phone,$email,$website) = db_fetch_row($qid); echo ' <tr> <td width="350">'.$company.'</td> <td>'.$firstname.' '.$lastname.'</td> <td>'.$phone.'</td> <td><a href="mailto:'.$email.'">'.$email.'</a></td> <td><a href="http://'.$website.'" target="_blank">'.$website.'</a></td> </tr>'; } } ?>
The actual page in question is:
http://www.bapva.com/members.php
Any ideas on how to make these co-exist on the same page? Right now, I just have a link to the forum...