Jump to content

eaglesphan

Members
  • Posts

    3
  • Joined

  • Last visited

    Never

About eaglesphan

  • Birthday 07/18/1953

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Delaware

eaglesphan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. As an example, this is what I have static: English Department Professors: Smith, Murray, King Associate: Professors: Jones, Rogers, Henry Assistant Professors: White, Scott, Stewart Instructors: Davis, Jackson, Walker Is there a way to pull all the faculty who belong to the English department and list them like the above sorted by their rank? If the results of a recordset are returned into the $row_rs_faculty array, is there a way to separate the results so they can be used as dynamic text to list the names? How exactly would that work? (if it can in fact be done)
  2. These pages used to work correctly but now they don't and I just need guidance on where to look to find the problem. I have a page that gets all information from a directory table according to last names. This page works fine. All records fetched have a link to Edit or Delete. When clicking on Edit, the information for the record is passed to another form with all the fields filled in. This works fine too. The problem is that when I edit a piece of information and submit, the form ADDS the corrected record rather than updating the information so I get a whole new record - which is wrong. What do I check to find out why the form is adding a new record rather than updating the current one? Here is the code for my edit record set on the problem page: <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE Directory SET last_name=%s, first_name=%s, title=%s, rank=%s, job_title1=%s, job_title2=%s, dept_num=%s, location=%s, room=%s, phone=%s, fax=%s, email=%s, doctor=%s, master=%s, bachelor=%s, associate=%s, tier=%s WHERE id=%s", GetSQLValueString($_POST['last_name'], "text"), GetSQLValueString($_POST['first_name'], "text"), GetSQLValueString($_POST['title'], "text"), GetSQLValueString($_POST['rank'], "text"), GetSQLValueString($_POST['job_title1'], "text"), GetSQLValueString($_POST['job_title2'], "text"), GetSQLValueString($_POST['dept_num'], "int"), GetSQLValueString($_POST['location'], "text"), GetSQLValueString($_POST['room'], "text"), GetSQLValueString($_POST['phone'], "text"), GetSQLValueString($_POST['fax'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['doctor'], "text"), GetSQLValueString($_POST['master'], "text"), GetSQLValueString($_POST['bachelor'], "text"), GetSQLValueString($_POST['associate'], "text"), GetSQLValueString($_POST['tier'], "int"), GetSQLValueString($_POST['tier'], "int")); mysql_select_db($database_connDESU, $connDESU); $Result1 = mysql_query($updateSQL, $connDESU) or die(mysql_error()); $updateGoTo = "directory_mod.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } $colname_rsDirectoryEdit = "1"; if (isset($_GET['id'])) { $colname_rsDirectoryEdit = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']); } mysql_select_db($database_connDESU, $connDESU); $query_rsDirectoryEdit = sprintf("SELECT * FROM Directory WHERE id = %s", $colname_rsDirectoryEdit); $rsDirectoryEdit = mysql_query($query_rsDirectoryEdit, $connDESU) or die(mysql_error()); $row_rsDirectoryEdit = mysql_fetch_assoc($rsDirectoryEdit); $totalRows_rsDirectoryEdit = mysql_num_rows($rsDirectoryEdit); ?>
  3. I have been working on a directory project as my first foray into PHP. I have DWMX2004. This is what I've done so far.... I have a table set up in MySQL that lists the usual stuff (name/phone/email/department/location, etc). So far I have created a page that lists the letters of the alphabet as 26 radio buttons in a form. When a person clicks on the letter A and sends it, all the people whose last name starts with A appear in a table on the same page. All of this works just fine. I have managed to create an admin page, an input page, an update page, and a delete record page and they all work. So far so good. Now for the fun part and this is where I'm stuck. I now want to create a page that lists all of the departments along with each's phone number and a link to that department's home page AND a link to the directory. The idea is that maybe you're looking for contact information for a person but you can't remember their name (therefore the alphabet page is usless to you). But you do know where they work. So you go to the department page, click on the directory link next to that department's name and voila, you have everyone listed in that department so you can pick out who you were looking for. It looks similar to this: President's Office Phone# Fax# Home link | Directory link Vice Pres's Office Phone# Fax# Home link | Directory link and so on After pondering on this problem, I thought maybe I should separate the department info from the original table and create another table. I now have a flat file ready listing all the department/phone/fax along with an identifying number for each. I am stuck in that I'm not sure how to pass the department number information to the database via URL to pull out what I need. If I have 75 different departments listed on the same page, does that mean I have to have 75 different recordsets - one for each link? Or can one recordset do the job but in that case, how do I make each link unique based on the department number without using a form w/radio buttons? If I go the master/detail page route, would that work seeing as how the detail I'm wanting can be over a dozen records rather than just one? I can see calling the department listing page the master page but I thought the detail page only had one record. Also, I don't want to list the department page according to department number or alphabetically. It needs to be listed according to an organizational structure that makes it difficult to pull it from a database in any sensical way so I can't create that page using a recordset. I hope this is making sense so ya'll know how to point me in the right direction.
×
×
  • 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.