Jump to content

Potatis

Members
  • Posts

    173
  • Joined

  • Last visited

About Potatis

  • Birthday 05/08/1974

Profile Information

  • Gender
    Male
  • Location
    Sydney, Au.

Potatis's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi Nerd99, did you solve this? If not, I spotted this: Try changing <li><a href="tutor_submit_report" target="_self">Submit Reports</a></li> </ul> </li> <li> to <li><a href="tutor_submit_report" target="_self">Submit Reports</a></li> </ul> in tutor_links.php
  2. If you don't find a host by Thursday, I am happy to host your trial, with a different domain name.
  3. Hi nerd99 Don't change your code, change your host. I thought every host supported mysqli by now. You can't just change the word "mysqli" to "mysql" and hope it will work. Mysqli has a different syntax, you have to change whole lines, and there is way too much code to change in your project for it to be worth the time. (I know, I have seen most of it... very very fine mysqli code. ). I'm not surprised if you are seeing thousands of errors. You need a host that will support the .com.au domain. If dreamhost did that (which they don't), I'd recommend them. Doug (the mad violinist)
  4. That doesn't look like a login form to me.
  5. Incredible! It worked first time! Donald Duck: 6 Rolf Harris: 5 Mickey Mouse: 5 Homer Simpson: 6 Super Ted: 4 Thanks so much jcbones, this is exactly what I wanted! I really appreciate the time you spent on this, and I am very happy that this is working! You're a legend! Now I will take the time to study the code and learn what you did. :D Another thanks again also to ignace for his time, and all other replies.
  6. Same old problem, it won't loop through the students. I'm not going to bother with this anymore. Thanks very much to ignace, jcbones and litebearer for your help, and anyone else who had some input! I'll have to do this another way, just search one student at a time instead of a full list. Thanks again!
  7. What if my column was called "y" instead of all the weeks, and I inserted "week 1" into it? firstname, lastname,y Fred, Flintstone,week3 Why didn't anyone think of this before? It's so easy.
  8. Ah ok, yes I see how the code shows student who have had all weeks. I need to have it show how many weeks as a progressive thing too. An admin should be able to look at week 3, or even week 1 - Lessons so far. What changes need to be made to my database scheme?
  9. Ok, the first query: SELECT * FROM student_roll WHERE tutor_name='Krismack' AND school='MPS' AND term='1' AND year='2010' ORDER BY last_name ASC Gives me the names of all students of tutor "Krismack, and their associated data, but where the name is duplicated, because of the different weeks with "y", their names appear multiple times. In this table that I am working with, Bugs Bunny appears in the list twice because there are two different entries. This query: SELECT first_name, last_name, count(*) as lessons FROM student_roll WHERE week1 = 'y' AND week2 = 'y' AND week3 = 'y' AND week4 = 'y' AND week5 = 'y' AND week6 = 'y' AND week7 = 'y' AND week8 = 'y' AND week9 = 'y' AND week10 = 'y' GROUP BY first_name, last_name Gives me one instance of each user, and how many times their name appears in the table (as the code instructs). Bugs Bunny 2, the rest 1.
  10. This is the full page as it stands: <?php include('includes/admin_session.php'); ?> <?php require_once("includes/connection.php"); // Set variables from search query /*$tutor_name = $_POST['tutor_name']; $school_name = $_POST['school']; $term = $_POST['term']; $year = $_POST['year'];*/ $tutor_name = "Krismack"; $school_name = "MPS"; $term = "1"; $year = "2010"; // Query database with the above variables to get all stored data belonging to the tutor, at X school during X term and X year $result = mysqli_query($connection,"SELECT * FROM student_roll WHERE tutor_name='$tutor_name' AND school='$school_name' AND term='$term' AND year='$year' ORDER BY last_name ASC") or die(mysqli_error($connection)); while($row = mysqli_fetch_array($result)) { //get first and last name of all students belonging to tutor at X school, term and year $student_first_name= $row['first_name']; $student_last_name= $row['last_name']; // Use student names to loop through table the names of all students who had a lesson on week 1 and display 1 // as the number of lessons they had. $result = mysqli_query($connection,"SELECT first_name, last_name, count(*) as lessons FROM student_roll WHERE week1 = 'y' OR week2 = 'y' OR week3 = 'y' OR week4 = 'y' OR week5 = 'y' OR week6 = 'y' OR week7 = 'y' OR week8 = 'y' OR week9 = 'y' OR week10 = 'y' GROUP BY first_name, last_name ") or die(mysqli_error($connection)); while($row = mysqli_fetch_array($result)) { $num_rows = mysqli_num_rows($result); echo $student_first_name . " " . $student_last_name . ": "; echo $num_rows; echo "<br />"; echo "<br />"; } } ?> I could understand why it might roll out 4 times with "1", but it isn't. It is adding the total lessons and doing that 4 times, and not going through the other 5 students. I currently have 6 students in my students_roll table.
  11. Thanks for the tip, litebearer! I don't have Word on my computer either, I am running a fairly barebones laptop at the moment, thanks to a recent Windows update that crippled my laptop and forced a drive wipe and reinstall. I have got Photoshop at home ready to reinstall now that the license issue has been sorted out after the other one was lost in the crash. I'll be home again tomorrow, I'll set up some software then.
  12. while($row = mysql_fetch_array($query)) { echo $row['title']; echo $row['description']; } Is what you need.
  13. Changing to OR gets us somewhere. It calculates correctly that Bugs Bunny has had 4 lessons, even though Bugs Bunny's lessons are recorded on different lines. WooHoo! But it does so 4 times: Bugs Bunny: 4 Bugs Bunny: 4 Bugs Bunny: 4 Bugs Bunny: 4 And there is no mention of the other students.
  14. I'll add that jcbones' code does calculate the right amount of lessons if the student is in the table once, but only the first user, it doesn't loop through the rest of the students. edit: The info can't be added all at once though, since the roll is updated weekly. I need to use INSERT though rather than update, otherwise I'd have to create a new table every term, so that the current table is not over-written. I want the table to be searchable in the future.
  15. No, I am working with a different database table (just for student_roll) because I am not at home, and didn't have that table on my laptop so I created a new one. I can't do a print screen and post because I don't have anything like photoshop installed, but my new database does have two students who have had 10 lessons, and the only one that has had 10 lessons with "y" is Fred Flintstone. I could do a table dump of that one table if you want, but since you have the table without data, you could experiment if you wanted to. I got bugs bunny:1 because it found my first student which was bugs bunny who had 4 lessons.
×
×
  • 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.