Jump to content

snwburotn

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by snwburotn

  1. Hello, First off thanks, great website very informative. I have looked every where on the web and I can't find out how to make a simple news feed based off a MYSQL database, just as you have on your home page. Can you please do a tutorial for it? Thanks
  2. I am trying to use master detail page set to display events and who is attending the events. On the master page I am displaying 2 columns Event name and Date, and on the detail page I am displaying Event name, Date, Last name, First name, Phone #, and Email. I am taking the data from 3 different tables, I have made the data shwo up correct on one dynamic table with this sql: SELECT attendevent.id, members.firstname, members.lastname, eventregister.name, eventregister.date, members.phone, members.email FROM members, eventregister, attendevent WHERE members.userid=attendevent.user_id AND attendevent.event_id=eventregister.event_id ORDER BY members.lastname , but I cant get it to show up correct in the Master Detail page set, I am new at coding but learning fast can any one help me out with this. The code below is my Master and Detail page code sets currently, with a little modification. THANKS! Attach Code Master: <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_eventattendance = 10; $pageNum_eventattendance = 0; if (isset($_GET['pageNum_eventattendance'])) { $pageNum_eventattendance = $_GET['pageNum_eventattendance']; } $startRow_eventattendance = $pageNum_eventattendance * $maxRows_eventattendance; mysql_select_db($database_ama, $ama); $query_eventattendance = "SELECT attendevent.id, members.firstname, members.lastname, eventregister.name, eventregister.date, members.phone, members.email FROM members, eventregister, attendevent WHERE members.userid=attendevent.user_id AND attendevent.event_id=eventregister.event_id ORDER BY members.lastname"; $query_limit_eventattendance = sprintf("%s LIMIT %d, %d", $query_eventattendance, $startRow_eventattendance, $maxRows_eventattendance); $eventattendance = mysql_query($query_limit_eventattendance, $ama) or die(mysql_error()); $row_eventattendance = mysql_fetch_assoc($eventattendance); if (isset($_GET['totalRows_eventattendance'])) { $totalRows_eventattendance = $_GET['totalRows_eventattendance']; } else { $all_eventattendance = mysql_query($query_eventattendance); $totalRows_eventattendance = mysql_num_rows($all_eventattendance); } $totalPages_eventattendance = ceil($totalRows_eventattendance/$maxRows_eventattendance)-1; $queryString_eventattendance = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_eventattendance") == false && stristr($param, "totalRows_eventattendance") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_eventattendance = "&" . htmlentities(implode("&", $newParams)); } } $queryString_eventattendance = sprintf("&totalRows_eventattendance=%d%s", $totalRows_eventattendance, $queryString_eventattendance); ?> <?php do { ?> <tr> <td><a href="eventparticipants.php?recordID=<?php echo $row_eventattendance['id']; ?>"> <?php echo $row_eventattendance['name']; ?> </a> </td> <td><?php echo $row_eventattendance['date']; ?> </td> </tr> <?php } while ($row_eventattendance = mysql_fetch_assoc($eventattendance)); ?> </table> <p> </p> <p><br /> </p> <table border="0"> <tr> <td><?php if ($pageNum_eventattendance > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_eventattendance=%d%s", $currentPage, 0, $queryString_eventattendance); ?>">First</a> <?php } // Show if not first page ?> </td> <td><?php if ($pageNum_eventattendance > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_eventattendance=%d%s", $currentPage, max(0, $pageNum_eventattendance - 1), $queryString_eventattendance); ?>">Previous</a> <?php } // Show if not first page ?> </td> <td><?php if ($pageNum_eventattendance < $totalPages_eventattendance) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_eventattendance=%d%s", $currentPage, min($totalPages_eventattendance, $pageNum_eventattendance + 1), $queryString_eventattendance); ?>">Next</a> <?php } // Show if not last page ?> </td> <td><?php if ($pageNum_eventattendance < $totalPages_eventattendance) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_eventattendance=%d%s", $currentPage, $totalPages_eventattendance, $queryString_eventattendance); ?>">Last</a> <?php } // Show if not last page ?> </td> </tr> </table> Records <?php echo ($startRow_eventattendance + 1) ?> to <?php echo min($startRow_eventattendance + $maxRows_eventattendance, $totalRows_eventattendance) ?> of <?php echo $totalRows_eventattendance ?> Detail: <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_DetailRS1 = "-1"; if (isset($_GET['recordID'])) { $colname_DetailRS1 = $_GET['recordID']; } mysql_select_db($database_ama, $ama); $query_DetailRS1 = sprintf("SELECT attendevent.id, members.firstname, members.lastname, eventregister.name, eventregister.date, members.phone, members.email FROM members, eventregister, attendevent WHERE id = %s AND attendevent.event_id=eventregister.event_id", GetSQLValueString($colname_DetailRS1, "int")); $DetailRS1 = mysql_query($query_DetailRS1, $ama) or die(mysql_error()); $row_DetailRS1 = mysql_fetch_assoc($DetailRS1); $totalRows_DetailRS1 = mysql_num_rows($DetailRS1); ?> <table border="1" align="left"> <tr> <td width="105" class="headingtext">Event:</td> <td width="291" class="headingtext"><?php echo $row_DetailRS1['name']; ?> </td> </tr> <tr> <td height="51" class="maintext">Date:</td> <td class="maintext"><?php echo $row_DetailRS1['date']; ?></td> </tr> </table> <p> </p> <p> </p> <p> </p> <table width="955" border="0" align="center"> <tr> <td width="277" class="subsubheadingtext">Last Name</td> <td width="250" class="subsubheadingtext">First Name</td> <td width="178" class="subsubheadingtext">Phone #</td> <td width="232" class="subsubheadingtext">Emial</td> </tr> <?php do { ?> <tr> <td height="22" class="maintext"><?php echo $row_DetailRS1['lastname']; ?></td> <td class="maintext"><?php echo $row_DetailRS1['firstname']; ?></td> <td class="maintext"><?php echo $row_DetailRS1['phone']; ?></td> <td class="maintext"><?php echo $row_DetailRS1['email']; ?></td> </tr> <?php } while ($row_DetailRS1 = mysql_fetch_assoc($DetailRS1)); ?> <tr> </table>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.