Jump to content

jandrews3

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by jandrews3

  1. I want the quiz questions a teacher loads to be randomized so that each time the teacher gives it (different class, different day, whatever …) the order of questions will be randomized. I'm loading the data into an array and then shuffling it. Problem solved. BUT … students on their smart devices need to load the same quiz with the same question order. I can solve this by: - teacher stores question and answer data and order temporarily in a dB table - students load that information - problem solved But I was hoping to do this without using a table. Is there a way to pass a randomized array from the teacher to the students without going through a dB table? Thanks.
  2. The first line in the <div> contained text with font-size 15pt but yet a line-height of 16px (at least, it did initially). That is apparently what caused it. If I shrink the font-size of the first line, the first line only, then the problem disappears. Apparently the line-height was too small for the font-size, which translated into a paging problem since it was the first line of the page.
  3. If I set the line-height in this code for anything less than 23, the iPad adds an extra page between pages yet the desktop prints normal. $querys = "SELECT * FROM inno_students WHERE teacher = '".$_SESSION['staff']['uname']."' AND course_id = '$course_id' ORDER BY lname, fname"; $results= mysql_query($querys) or die("Could not perform query: ".mysql_error()); while ($rows = mysql_fetch_array($results)){ print "<div style=\"font-size: 12pt; line-height: 22px; ".$page."\">"; $page = "page-break-before: always;"; print "<p align=\"center\" style=\"font-size: 15pt; font-weight: bold; margin: 0px 0px;\">\n"; print "Skill Remediation<br><span style=\"font-size: 12pt;\">".$subject."</span>\n"; print "</p>\n"; print "<p align=\"right\" style=\"margin: 0px 0px;\">\n"; print "Name: <b>".$rows['lname'].", ".$rows['fname']."</b><br>\n"; print "Today's date: <b>".date("M j")."</b><br>\n"; $today = date("U"); $due = $today + (86400*3); print "Due date: <b>".date("M j", $due)."</b><br>\n"; print "</p>\n"; print "</div>"; }
  4. I teach Spanish and I've written a script to create remediation sheets for students based on their recorded progress. So, my first objective is to generate a webpage with data for 35 different students pulled from a database. Way easy. My second objective is to put page breaks between the students so that I can print the webpage and every student has his/her own sheet. Kind-of-success. My problem is that my laptop prints just fine, but I want this ability from my iPad. I've written my entire website so that I can teach from my iPad in class and be totally unbound from my laptop. When I run the same script (load the same page) from my iPad, I get an BLANK page between every student. I'm using page-break-before: always in a recurring <div></div> loop with the entire data-set for a student inside a div. I captured a source code from the laptop AND from the iPad, and they're both identical. So, the problem is that they are treating the page-break-after differently. I don't understand. While the page is generated using PHP, that is not the issue. It is the browser interpretation of the CSS/HTML which is causing the problem. Hence, I have included the sample HTML source code for the first 2 students in the class. <body style="color: #000000; background-image: none; background-color: #ffffff; font-size: 10pt; line-height: 25px;"> <div style="page-break-before: always;"> <p align="center" style="font-size: 15pt; font-weight: bold; line-height: 16px; margin: 0px 0px;"> Skill Remediation<br><span style="font-size: 12pt;">Spanish I</span> </p> <p align="right" style="line-height: 16px; margin: 0px 0px;"> Name: <b>Adams, Kendra</b><br> Today's date: <b>Mar 17</b><br> Due date: <b>Mar 20</b><br> </p> C.O.P. Phrases<br> __________________________________1. Es importante.<br> __________________________________2. ¿Dónde está la grapadora?<br> __________________________________3. ¿Qué página?<br> __________________________________4. Me ayudas, por favor.<br> __________________________________5. Necesito la tarea.<br> Articles<br> __________________________________1. (some) perros<br> __________________________________2. (a) lápiz<br> __________________________________3. (some) carteles<br> __________________________________4. (a) coche<br> __________________________________5. (the) curso<br> Noun-Adjective Agreement<br> __________________________________1. casas (grande)<br> __________________________________2. texto (nuevo)<br> __________________________________3. playas (divertidos)<br> __________________________________4. playa (divertido)<br> __________________________________5. sobrinos (trabajador)<br> </div> <div style="page-break-before: always;"> <p align="center" style="font-size: 15pt; font-weight: bold; line-height: 16px; margin: 0px 0px;"> Skill Remediation<br><span style="font-size: 12pt;">Spanish I</span> </p> <p align="right" style="line-height: 16px; margin: 0px 0px;"> Name: <b>Brown, Brittney</b><br> Today's date: <b>Mar 17</b><br> Due date: <b>Mar 20</b><br> </p> Preliminares Vocabulary<br> __________________________________1. Fine, thank you.<br> __________________________________2. Please.<br> __________________________________3. How much is it?<br> __________________________________4. It is at one o'clock.<br> __________________________________5. it's good weather.<br> Verb SER (Present Tense) Lv1<br> __________________________________1. Doug and Steve are from Cookeville.<br> __________________________________2. I am bad.<br> __________________________________3. Jeff is from Greenville.<br> __________________________________4. Where is she from?<br> __________________________________5. John is mean.<br> ¿Cómo es?<br> __________________________________1. ¿Somos nosotros aburridos? (no)<br> __________________________________2. ¿Cómo eres? (hardworking)<br> __________________________________3. ¿Eres trabajador? (sí)<br> __________________________________4. ¿Cómo somos nosotros? (good)<br> __________________________________5. ¿Cómo es Mary? (pretty)<br> </div> OKAY, LET ME BRIEFLY RESTATE THE PROBLEM HERE: Between the two <div></div> the iPad is printing a blank page, but the laptop is not. The laptop is printing as desired … one page per student. The iPad is printing one page per student with a blank page inbetween each. THANK YOU!!!
  5. I'm writing a script which needs to hide all elements of a certain ID on page load, and display them upon clicking the link 'Toggle'. The following code hides all the questions, but only shows the first question when 'Toggle' is clicked even though they all have the same ID. I'm very new at javascript and greatly appreciate your help. Thanks. <script type="text/javascript"> function hideshow(which){ if (!document.getElementById) return if (which.style.display=="block") which.style.display="none" else which.style.display="block" } </script> <a href="javascript:hideshow(document.getElementById('adiv'))">Toggle</a> <div id="adiv" style="font:24px bold; display: none">Question 1</div> <div id="adiv" style="font:24px bold; display: none">Question 2</div> <div id="adiv" style="font:24px bold; display: none">Question 3</div> <div id="adiv" style="font:24px bold; display: none">Question 4</div> <div id="adiv" style="font:24px bold; display: none">Question 5</div> <div id="adiv" style="font:24px bold; display: none">Question 6</div> <div id="adiv" style="font:24px bold; display: none">Question 7</div> <div id="adiv" style="font:24px bold; display: none">Question 8</div> <div id="adiv" style="font:24px bold; display: none">Question 9</div> <div id="adiv" style="font:24px bold; display: none">Question 10</div> <div id="adiv" style="font:24px bold; display: none">Question 11</div> <div id="adiv" style="font:24px bold; display: none">Question 12</div>
  6. I have found a way to stop the bounce but it also stops <div> from scrolling which I must have. I've got the following code inside the <head> element: <script> document.addEventListener("touchmove", function(event){ event.preventDefault(); }); </script> The page doesn't bounce and I absolutely LOVE it! BUT I must have a div on the page to scroll. It contains skill data for my students which needs to scroll for them to see it all. Thanks.
  7. Thank you! Works great. I should have seen that. Thank you again!
  8. I can't figure out why my shuffle function is behaving the way it is. I've populated a multi-dimensional array $_SESSION['data']['question'][$count], $_SESSION['data']['answer'][$count], and $_SESSION['data']['type'][$count]. When I run the code without the shuffle function, it works properly by printing the question, answer and type data to the screen. But when I use the shuffle() function, my printout to the screen is blank. Thanks. Here is my code: // Get and Assign Questions and Answers $counter = 0; $query3 = "SELECT * FROM inno_quiz_questions WHERE quiz_id = '".$row2['id']."' ORDER BY id"; $result3= mysql_query($query3) or die("Could not perform query: ".mysql_error()); $qnum = mysql_num_rows($result3); while ($row3 = mysql_fetch_array($result3)){ $_SESSION['data']['question'][$counter] = $row3['question']; $_SESSION['data']['answer'][$counter] = $row3['answer']; $_SESSION['data']['type'][$counter] = $row3['type']; $counter++; } shuffle($_SESSION['data']); // Shuffle array $count = 0; while ($count < $_SESSION['quiz']['assigned']){ print $count.". ".$_SESSION['data']['question'][$count]."<br>"; print $_SESSION['data']['answer'][$count]."<br>"; print $_SESSION['data']['type'][$count]."<br><br>"; $count++; }
  9. Ok, you have a 'settings.php' file in a folder titled 'edit' AND you have an 'overallheader.php' file in a folder (overall) inside another folder (includes). Right? Okay, to reference the overallheader.php file from the settings.php file your include needs to look like this: include '../includes/overall/overallheader.php'; This backs you out of the "edit" folder, and takes you through both the "includes" folder and the "overall" folder. If this isn't working, I think you might have different pathways than you have stated here.
  10. When you move a file either into a new folder, or out of an old one, you have to re-assess all of its references ... images, links, includes ... everything ... but only in that one file. So, in your 'settings.php' file, if you had an 'include' statement that read INCLUDE 'SOME_FILE.PHP'; you would now need to add ../ to the beginning of it as such INCLUDE '../SOME_FILE.PHP'; If your settings file was referencing any images also or any other kind of resource (page, link, file, etc...) you're going to need to do the same there, also.
  11. When you moved the 'settings.php' file inside another folder, did you change the pathway of your 'include' statements? If not, you should add " ../ " to your pathways. That will back up out of the new folder (directory) you put the file in.
  12. I'm using a database driven session variable authentication for my website. When I put the authentication in the webpage, it works fine. BUT, when I use an "include" to put it in, the page gives me an error. Here's the code: <?php session_start(); extract($_REQUEST); $link = mysql_connect("???????","???????","???????") or die("Could not connect: ".mysql_error()); mysql_select_db("???????")or die("Could not select database: ".mysql_error()); $query = "SELECT * FROM bowl_users WHERE uname = '{$_SESSION['user']['uname']}'"; $result = mysql_query($query) or die("Could not perform query: ".mysql_error()); $row = mysql_fetch_array($result); if ($_SESSION['user']['uname'] == ""){ print "<META HTTP-EQUIV=\"Refresh\" content=\"0;URL=index.php?improper=1\">"; } else { ?> I thought an "include" was the same as having the code in the page itself. The error I'm receiving is: Parse error: syntax error, unexpected '}' in /home/content/45/4971845/html/knowledge/bowl.php on line 120 Now I understand what the error is saying. I have a <?}?> at the end of my page to close out the "else" statement up above in the code. And it works just fine IF I don't use the include, but rather actually type the text in the page. i can do that, but I'd rather use as many "include"'s as I can. Thanks.
  13. I'm just missing something stupid, I know I am, but I've been working on it for more than an hour. Why does the following code: $month = 3; $day = 9; print "M: ".$month."<br>"; print "D: ".$day."<br>"; $due = $month." / ".$day; print $due."<br>"; print date("M j", $due)."<br>"; yield the following output: M: 3 D: 9 3 / 9 Dec 31 AUGGHHH! Shouldn't the last line be "Mar 9"???? I know. I'm stupid but my brain fried after I accidentally deleted my quiz table with nearly 90 quizzes for my students ... and NO, I was too stupid to have backed it up. So ... I'm not all here right now. But I just can't figure what's going wrong with this script. Thanks!
  14. @Barand - THANK YOU!!! That piece of code helped me to do exactly what I needed.
  15. $team[0] is team 1, it's value is the points team 1 has earned. And so on.
  16. I appreciate your help, but all either of those two scripts seemed to do was to display the data. I need to determine WHICH team had 1st, 2nd and 3rd place. That is to say, I need the script to determine that, so that extra credit points to my students can be automatically awarded.
  17. Yeah, I've found a bunch of possible functions for arrays, but my problem is that I'm totally inexperienced in using them. I suck at manipulating arrays. I'm not sure that sorting the array here is what I really need. What I need to do is find out which field, $team[0], $team[1], $team[2], $team[3], $team[4], $team[5], $team[6] or $team[7] has the highest value. Then I need to do the same to find out which has the second highest value, and then again for the third highest. Sorting may very well be what I need to do here, but I don't need the actual value ... I need to know which $team[] contains it. I can't figure out how to do this without a helluva lot of IF statements. I appreciate the help, but if rsort() or arsort() are possible solutions, I have no idea what the code would look like. Thanks.
  18. I'm sure this is an easy operation, but I suck at manipulating arrays. I have an array $team[0] through $team[7] all filled with integers and I need to know which field contains the 3 highest values. I'm using this to determine which teams in my classroom came in 1st, 2nd and 3rd place. Thanks.
  19. This is a common type of login feature. I use it myself. Put a button on your homepage linking to a members only page. On the members only page (and on all such pages on your website) use the following: session_start(); if (!isset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) || !($_SERVER['PHP_AUTH_USER'] == $uname && $_SERVER['PHP_AUTH_PW'] == $pword)) { header('WWW-Authenticate: Basic realm="Authorization Required!"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required!'; exit; } else { your page coding goes here } When clicked, the button will take you to the linked page but will NOT reveal any of it until you have entered a username and password. I use $uname and $pword as variables checked against a database specific to an individual member. BUT, you could just have one set username and password for anybody. If this is a school project, that would certainly be easier. If you go this route, just insert something like: uname = bob; password = dallascowboys;
  20. I'm afraid I don't know the answer to either of your questions. I'm too amateur to know even that there had been a problem with the php mail() function. I had never heard that, but then maybe I had always been using an older php version. The second question, a dns problem? I don't know. I would have thought if there were a dns problem that the failed emails should be consistent, but they're not. My mail scripts which send singular emails have not had this problem. But then the first 50 to 100 emails in this script always seem to successfully send. I'm going to try the delay thing. I wondered if something like that might be happening.
  21. It's really strange. A bunch will send successfully starting out, then a couple hundred will fail. Then again another set of 30 or 40 send properly followed by another set of a few hundred failures. There are also examples of individual successful sends scattered inside large blocks of failures. I would think something was wrong with the script or the data but for the fact that 1) the script worked perfectly on our previous server, and 2) which email fails and which succeeds appears to be random after having run the script several times. One test I ran was to manually change the "send to address" in the code from the variable $to to my own email address ... so each time the loop cycled it would look like it was sending to the member, but it would actually send to me. The script ran without problem and I received the expected 1169 emails. But when changed back to the $to variable, the random failures popped up again. Auuugggghhhh!
  22. Yes, I would have expected none of them to send. However, each time the script runs, I get a random set of "sends" and a random set of "failures." I have several other mail() statements on other pages. But it is this massive repetitive script (looping through the entire membership sending over 1000 emails) which fails.
  23. I have a simple php mail statement pulled from a database for about 1200 members of an organization. It worked perfectly on the previous server I had it on, but since we've moved to a new server I'm getting an odd result. I'm getting some (about a quarter) emails sent and a failure to send on the others. With the script run several times, I get different results. For example, on the first run, Bob's email might get sent, but on the second one his is one of the failures. Below is the brunt of the script. I don't believe the problem is in the script but rather something with the server. Has anyone had a problem like this, or have any idea of what it may be? THANK YOU!!! $query1 = "SELECT * FROM ithf_members WHERE email != '' ORDER BY lname, fname"; $result1 = mysql_query($query1) or die("Could not perform query: ".mysql_error()); $fset = "-fpkomornik@ithf.org"; $count = 0; if ($recip == 1){ while ($row1 = mysql_fetch_array($result1)) { if ($row1['active'] > 1){ $to = $row1['email']; $subject = $subj; $body = $msg; $headers = "From: pkomornik@ithf.org\r\n" . "X-Mailer: php\r\n". "Return-Path: pkomornik@ithf.org\r\n"; if (mail($to, stripslashes($subject), stripslashes($body), $headers, $fset)) {echo("<p>Sent to ".$row1['fname']." ".$row1['lname']." at ".$row1['email']."</p>");} else {echo("<p>Failed to send to ".$row1['fname']." ".$row1['lname']." at ".$row1['email']."</p>");} $count++; } } }
  24. I need to update a particular table and there be a whole lot of field names. I'd like to do it without having to use them the same way you can access then like $row[12] after a "select" query. The standard for updating (at least how I write it) goes like this ... $query = "UPDATE linguistics SET welcome1='$var3', welcome2='$var4' WHERE language = '$lengua'"; Well, I'd like to do it where I don't have to name welcome1 and welcome2, but instead refer to their numerical position within the database. On a "select" query we can do this. Can this be done on an update? Something perhaps like ... $query = "UPDATE linguistics SET 3='$var3', 4='$var4' WHERE language = '$lengua'"; ... where 3 and 4 represent the 4th and 5th fields respectively. I know that this particular phrasing doesn't work because I've tried it, but surely there has to be something. This will save me LOTS of time. Thanks!!
  25. Dude! Awesome! I knew it would be easy, just not THAT easy. I just don't know anything. That worked like a gem! THANKS!!!
×
×
  • 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.