Jump to content

odisey

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Everything posted by odisey

  1. Thanks guys for pointing me to the error logs. I resolved this. It was actually a syntax error. The UPDATE table SET query was lacking a few ANDs in the WHERE part. I have WHERE variables separated by commas. Marc
  2. The code I posted is part of the most recent update. Additionally, I changed the INSERT query to a UPDATE table SET query on all 45 questions. I have a virtual server I am using for this ... I am searching the admin panel foe the error logs... The actual error is not a php output error. It is a browser error ..... url not found ,,, page cannot ne displayed error. Cannot find server or DNS Error Internet Explorer Marc
  3. That was just too simple.... Got right by me..... Let's look at this first.... The three variables are passed to the page ... that is OK.... Header code..................... // Check for a valid user ID, through GET or POST. if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { // Accessed through view_users.php $s_id = $_GET['id']; } elseif ( (isset($_POST['student_number'])) && (is_numeric($_POST['student_number'])) ) { // Form has been submitted. $s_id = $_POST['student_number']; } else { // No valid ID, kill the script. echo '<h1 id="mainhead">Page Error!!</h1> <p class="error">This page has been accessed in error 1.</p><p><br /><br /></p>'; include ('includes/footer.html'); exit(); } // Check for year through GET or POST. if ( (isset($_GET['year'])) && (is_numeric($_GET['year'])) ) { // Accessed through view_users.php $ye = $_GET['year']; } elseif ( (isset($_POST['year'])) && (is_numeric($_POST['year'])) ) { // Form has been submitted. $ye = $_POST['year']; } else { // No valid ID, kill the script. echo '<h1 id="mainhead">Page Error!!</h1> <p class="error">This page has been accessed in error 2.</p><p><br /><br /></p>'; include ('includes/footer.html'); exit(); } // Check for term, through GET or POST. if ( (isset($_GET['midterm_final']))) { // Accessed through view_users.php $mf = $_GET['midterm_final']; } elseif ( (isset($_POST['midterm_final']))) { // Form has been submitted. $mf = $_POST['midterm_final']; } else { // No valid ID, kill the script. echo '<h1 id="mainhead">Page Error!!</h1> <p class="error">This page has been accessed in error 3.</p><p><br /><br /></p>'; include ('includes/footer.html'); exit(); } require_once ('mysql_connect_benedum.php'); // Connect to the database. A lot of code.................... <br> <b>Student Number</b> <?php echo '<p>' . $s_id . '</p><br />';?> <b>Year</b> <?php echo '<p>' . $ye . '</p><br />';?> <b>Term</b> <?php echo '<p>' . $mf . '</p><br />'; ?> <input name="student_number" type="hidden" maxlength="9" value="<?php echo $s_id; ?>" /> <input name="year" type="hidden" value="<?php echo $ye; ?>" /> <input name="midterm_final" type="hidden" value="<?php echo $mf; ?>" /> A lot of code.................. Marc
  4. I'm new.... I am not sure what the key area is.... Marc
  5. I've recently installed PHP in the Ubuntu environment, and phpmyadmin. Both installed flawlessly - Ubuntu is good about snaptic packages and installs. There was some configuring for the php though. I have a list of things I did, I am not sure that will help you though. If you are interested, let me know and I will post it. First though ... I did not use the CLI.... I installed through the desktop version of the server admin. Marc
  6. This is a parsing problem - I think. I have written two pages of code. One to input new records into a student score data base. There are 45 questions on the page and about 5000 lines of code. The second page is an update page which allows an evaluator to update scores already entered into the db. There are 7000 lines of code. ??? :-X :-\ :'( While creating these pages I've experienced every emoticon. So.... The first page executes excellently. The second page gets a server not found error..... I am sure all paths are accurate ... absolutely.... Before I post code.... Can anyone think of a reason an UPDATE table SET $values WHERE $otherValues would return a server not found error? Something common I have not though of? Otherwise I will post code.... I've narrowed it down to a few variables,,,, Marc
  7. If you say nothing at all is being printed, just maybe... Thank's for pointing that out...I've closed the buffer. Marc
  8. Sir helper this code resolved it. I left the @ in place, and code executes. Thank you! Thank's for all the input! Marc
  9. I thought that would print.... nope,.... Do not understand... With php.... 7000 lines of code and one dot in the mix ..... you know... Nope... not yet. TY for the support and ideas.... Marc
  10. Try this: echo '<p> "bla bla bla" ' . $info['username'] . '</p>' ; I spaced stuff out so you can see the single quotes. So you could also say it is 'spaced out!' Marc
  11. I've tried all following ---nothing prints.... $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<p align="left"><a href="editStudentScore.php?student_id=' . $s_id . '&year=' . $row['year'] . '&midterm_final=' . $row['mf'] . '">Edit year ' . $row['year'] .' and term ' . $row['mf'] . '</a></p>'; echo '<br /><br />'; } } else { echo "No Results Found"; } // else { // elseif (!$result) { // if (!isset($result)) { // echo '<p>There is no evaluation data entered for student ' . $s_id . '. Please return to the Enter New Student Record page to enter a new data record for this student.</p>'; }
  12. I am not sure if this snippit is helpful. You may modify it to accomplish what you are trying to accomplish though. // Check for a trailing slash or HERE YOU MODIFY TO CHECK FOR WHAT YOU WANT TO SPLIT if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Add the page. $url .= '/index.php'; Maybe something like: // Check for a garbage if ((substr($url, -1) == 'sote/dfd/') OR (substr($url, -1) == 'sote\dfd\') ) { $url = substr ($url, 0, -1); // Split. } // Add the page. $url .= '/dfd.index.php;
  13. I've written the code to parse a column and create links. Easy enough. If ($result) the while statement executes. Now I am trying to integrate an echo that will execute only if there is NO record retrieved. Sounds simple. What am I missing here? If, elseif, else, nothing is printing..... <?php # Nov 24 2007 Marc Debiase // Edit Student Records session_start(); // Access the existing session. // Include the configuration file for error management and such. if (isset($_SESSION['user_level']) && ($_SESSION['user_level'] == 1) ) { include('includes/adminHeader.html'); } else { include('includes/header.html'); } ob_start(); // Check for a valid user ID, through GET or POST. if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { // Accessed through view_users.php $s_id = $_GET['id']; } elseif ( (isset($_POST['student_number'])) && (is_numeric($_POST['student_number'])) ) { // Form has been submitted. $s_id = $_POST['student_number']; } else { // No valid ID, kill the script. echo '<h1 id="mainhead">Page Error!!</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; include ('includes/footer.html'); exit(); } // Access the existing session. // Include the configuration file for error management and such. require_once ('includes/config.inc.php'); // Set the page title and include the HTML header. $page_title = 'Edit Student Records'; echo '<h1 id="mainhead">Edit student records</h1><br /><br />'; echo '<p>Following is a list of record years and terms containing evaluation data for student ' . $s_id . '. If you do not see the year and term of data you wish to edit, it is not yet entered into the data base. Please return to the Enter New Student Record page and enter the data as a new record.</p>'; echo '<br /><br />'; // If no first_name variable exists, redirect the user. if (!isset($_SESSION['first_name'])) { // Start defining the URL. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for a trailing slash. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Add the page. $url .= '/index.php'; ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. } else { // MAIN ELSE require_once ('someDataBase.php'); // Connect to the database. // $query = "SELECT DISTINCT year FROM student_score WHERE mid_final = '$mf' AND student_id = $s_id ORDER BY year ASC"; $query = "SELECT DISTINCT year as year, mid_final AS mf FROM student_score WHERE student_id = $s_id ORDER BY year ASC"; $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<p align="left"><a href="editStudentScore.php?student_id=' . $s_id . '&year=' . $row['year'] . '&midterm_final=' . $row['mf'] . '">Edit year ' . $row['year'] .' and term ' . $row['mf'] . '</a></p>'; echo '<br /><br />'; } } else { // elseif (!$result) { // if (!isset($result)) { echo '<p>There is no evaluation data entered for student ' . $s_id . '. Please return to the Enter New Student Record page to enter a new data record for this student.</p>'; } } // CLOSE MAIN ELSE echo '<p>This is a complete list of record years and terms containing evaluation data for student ' . $s_id . '. Click on the data link you wish to edit.</p>'; include ('includes/footer.html'); ?> Thank you for feedback, Marc
  14. I got it! Thanks to you help. $query = "SELECT DISTINCT year as year, mid_final AS mf FROM student_score WHERE student_id = $s_id ORDER BY year ASC"; Thank you again, Marc
  15. You guys are genius.... This is why I come here... Absolutely brilliant. I know php has these functions, short cuts, etc... I have no formal training .. I am learning... Trying to write WHILE, FOR, IF statements to accomplish this for three days.... and all I had to do was add the word DISTINCT to the query... GO figure,,, So you added a count function to the example.... this is good.,,,,,,, I can use that. Is it possable to add one more feature..... (Maybe I can actually figure this one out) A feature that lists the DISTINCT years and terms as well. There is a possibility of the followinf output ------------------------------------------- year term 2006 M = Midterm 2006 F = Final 2007 M ------------------------------------------- The 2007 F (Final) data did not print because the query did not find a record in the year 2007 for the student associated with the 'final' evaluation; only the midterm was recorded at the time of the query. Marc
  16. OK - maybe this makes more sence. If I SELECT * FROM $year WHERE studend_id = $s_id And ORDER DESC in an array() When I print the output can I write a conditional which prints multiple years only 1 time and creates a link. For example, something like: $value // this is the array() variable loaded with data $year = $ value; echo $year // this is the first link I will code here FOREACH ($year >!= $value) { echo $ year } else { echo All years are printed }
  17. Using mysql_fetch_array() or the $num function, or something I am not thinking of, it is possable to sort the results of a query on one table - as mentioned above in the example ' dates, ' and create three links ? Marc
  18. Hello, I know I can select from several columns and using an array separate the columns into rows effected row[0] row[1] etc... Is it possable to parse one column named dates and create three links based on the range of dates in the db. For example, if dates has 20 records (10 = 2005, 5 = 2006, 5 = 2007), can I order the results in a decending order and create only the three links based on output, and garbage the rest. 2007 2006 2005 So the first is automatically a link 2007 = Link The second: if (second) <!= (first) second = link 2006 = link ] else [ move on The third: if (third) <!= (second) third = link 2005 = link ] else [ na da... Is something link this possable? Marc
  19. Hello, I am trying to do something that seems simple enough. I have a drop down menu on a record insert page. This is it: <select name="question5"> <option value="n~n~n">----SELECT----</option> <option value="5~0~1">Not Applicable</option> <option value="5~0~2">Unsatisfactory</option> <option value="5~1~3">Basic</option> <option value="5~3~4">Proficient</option> <option value="5~4~5">Distinguished</option> </select> I want to create an edit page, and I would like the edit page to first $query the db and get the already entered scores, then automatically set the current option on the drop down for the editor. For example if student 7001234 got a score of 3 on question 5, when the edit page loaded for that student_id number question 5 on the form would already be selected as "3". The options values are 5=question number~0-4=score~1-5=description of score (basic, proficient, etc.). I was thinking of setting the option based on an IF statement something such as: If $result (for a query of question 5 = 5 [this is distinguished]) { set option to ,,,,, } else (4) { set to } else (3) etc..... Does this make sense? How can I accomplish this? Marc
  20. That's not good - confusion. The idea is to populate a student_score table row with one drop down selection option. This populates the question_id, score, and description_id (this is something I added) with one submit.
  21. I've solved it with some friend's help: I can get the question number, score, and description id this way: <select name="question"> <option value="15~0~1">Not Applicable</option> <option value="15~0~2">Unsatisfactory</option> <option value="15~1~3">Basic</option> <option value="15~3~4">Proficient</option> <option value="15~5~5">Distinguished</option> </select> $choice = explode ('~', $_POST['question']; $qu = $choice[0]; $sc = $choice[1]; $de = $choice[2];
  22. So - Have the skeleton site built now. Registration with email admin approval (activation), regular and admin user access levels, change and retrieve passcode. Now I am thinking about inserting records. I've studied the tables you suggested and the logic of the inner join to retrieve data. I wrote a inner join as well from what I've learned. SELECT student.studentname, question.question, score.description, SUM(student_score.score) as total FROM student_score INNER JOIN question ON student_score.q_id = question.q_id INNER JOIN area ON question.area_id = area.area_id INNER JOIN characteristics ON area.char_id = characteristics.char_id INNER JOIN student ON student_score.student_id = student.student_id INNER JOIN score ON student_score.description_id = score.description_id WHERE student_score.mid_final = 'M' AND student_score.student_id = '7001234' AND student_score.year = '2006' GROUP BY student.studentname, question.question ORDER BY total DESC There is probably some rubbish I can weed out of there - what is important is I added an id the the score table giving each score and description a unique id - the join I wrote retrieves the records and displays them in an order that allerts the evaluator to weak and strong areas the student has in order , and etc. Now I am thinking about: 1) Creating a student record - Name, bio, student number (student number = student_id). I need to populate the student_info table AND the student_score table with the student_id. All other tables have a set field value ids that are accessed and associated with joins (ie score has set ids of 1 - 5, questions have set ids 1 - 20, etc.) The question record ids are auto_increment. The only new ids I need to insert are of course the student ids and they need to be inserted into two tables with one query - on the student registration. Is this possable? 2) Inserting scores from a drop down form. If the evaluator selects NA for question one for example the db is populated with INSERT INTO student_score (score, description_id) VALUES ("$score","$des_id") WHERE student_id = "$student_id" AND question = "$question"; Can I insert all this data with ONE drop down selection? SO I am deriving my values ("$score","$des_id") from the drop down - which may be the 'key' and 'value' - if they are the 'key' and 'value' - are both these array values passable to (score, description_id)?
  23. I have some snippets of ideas from Google - I am not sure how to do this. I am sure it is probably easy. Here is the layout idea: A realestate company site. There are five pages - each a different area. For example page 1 is HOMES, page 2 is LAKE PROPERTY, and etc.... On each page I want to: 1) associate a thumb_nail with a description of the property. 2) forward to a new page with multiple images if the thumb is clicked 3) when updating the site I want to purge all images associated with a listing when the listing is deleted from the db. I am thinking the images are uploaded to a images_folder probably with a unique name generated on upload; perhaps a time-stamp. I am not sure how to accomplish this yet - any ideas are greatly welcome. Thank you, Marc
  24. I agree - mistakes are more likely with complex syntax. You understand - not writing it and at a learning level - making sure of what I am reading reinforces the concepts of aliases, etc... I am building tables - I have the mid_final set to ENUM('M' , 'F'). I am down to the last table now. This is something I don't understand yet - never read anything about it either. I am unsure of the realtionship between student_score.score and score.value It lookf like a PK FK relationship - it is not though. I understand that this table has hard coded values with descriptions - and a value is called from this table to populate the score field container in student_score. -- I'm thinking it through -- this should be simple. Maybe it is an index relationship - I will try that first.
  25. Here is my guess -- for error analysis SELECT charistic.char_desc, SUM(student_score.score) FROM score.student_score INNER JOIN question q ON student_score.q_id = q.q_id INNER JOIN area a ON question.area_id = a.area_id INNER JOIN char_desc c ON a.char_id= c.char_id WHERE student_score.midfinal = 'midterm' AND student_id = '7001234' GROUP BY charistic.char_desc I am going to build this now and start testing it. I am getting an idea of where too start - you can see. The little training I have has taught me that I can use aliase to simplify teh queries syntax. You used one for 'AS total' I am unsure of your code that uses the following: SELECT s.studentname, c.char_desc, SUM(ss.score) as total I have a question. Is the s in s.studentname shorthand for student.studentname? And is SUM(ss.score) shorthand for SUM(student_score.score) I am not sure if you are writing it this way to save notation time - and ramp up the intuitiveness for someone learning - or if it will actually execute that way. I will try both the sorthand and long hand codes and see what happens. Do you have a resource for tutorials which lead the student through simple to complex table structures and query options? If so I would like to study it. Thank you - Now I will give thiese tables a try and get back.
×
×
  • 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.