Jump to content

benphp

Members
  • Posts

    336
  • Joined

  • Last visited

Everything posted by benphp

  1. I think I figured it out. Select DISTINCT students.SID, students.LastName, students.FirstName FROM classes_students as cs LEFT JOIN classes ON (cs.CLID=classes.CLID) LEFT JOIN students ON (cs.SID=students.SID) WHERE students.EID NOT IN (SELECT DISTINCT classes_students.EID FROM classes_students LEFT JOIN classes ON (students.CLID=classes.CLID) WHERE classes.CDate > '2010-01-01' ) ORDER BY students.LastName ASC
  2. I can get the positive - that is, students who do have a record after a certain date. Select DISTINCT students.SID, students.LastName, students.FirstName FROM classes_students LEFT JOIN classes ON (classes_students.CLID=classes.CLID) LEFT JOIN students ON (classes_students.SID=students.SID) WHERE classes.Cdate > '2009-01-01' However, I can't figure out how to get students who have NO record for dates beyond 2009-01-01.
  3. I have 3 tables: classes CID|Cdate students SID|LastName|FirstName classes_students CLID|SID|CID I'm trying to get the students who have NOT attended a class since 2009-01-01. I've managed to kludge together something with if statements, but I'd like to know how to do it properly in SQL. I can write the SQL to get positive results, but I can't figure out how to get negative results. Any help is appreciated!
  4. But I set it to expire in the past - not zero. I just tried it after closing the browser, but the VB still reads a cookie - "not nothing". It also still shows up in PHP: if (isset($_COOKIE['username'])) { $username = $_COOKIE['username']; print "$username not nothing."; } $username is blank, but it isn't nothing.
  5. I'm writing a cookie using VB in an ASPX file: username = "myname" If Request.Cookies("username") Is Nothing Then Response.Cookies.Set(New HttpCookie("username", username)) Response.Write("newcookie <br />") Else Response.Cookies.Set(Request.Cookies("username")) Response.Write("not nothing <br />") End If Response.Cookies("username").Expires = DateTime.Now.AddYears(1) and I can read it in PHP: if (isset($_COOKIE['username'])) { $username = $_COOKIE['username']; } But when I kill it with PHP ... if (isset($_COOKIE['username'])) { setcookie ("username", NULL, time()-3600*24*300 ); //300 days unset($_COOKIE["username"]); } ... the VB in the ASPX file still sees it and thinks it's an empty string, since it returns: "not nothing" It would seem that the cookie is still alive somewhere, no? And how do I kill it completely, so that the VB writes a new cookie with the same name?
  6. I have 4 tables, linked this way: tblCourses.CORID - tblClasses.CORID tblClasses.CLID - rsTblClass_Students.CLID rsTblClass_Students.EID - tblEmployee.EID tblEmployee.EID I'm trying to write a query that will return the names of employees who haven't taken a course (CORID). A record is kept of all the employees (EID) who have taken a class (CLID). I need to find all the employees who have NOT taken any classes. Any help is much appreciated. I tried this, but it doesn't quite work: Select DISTINCT tblClasses.CLDate, tblClasses.CLID, rsTblClass_Students.EID, tblEmployee.ELastName, tblEmployee.EFirstName, tblCourses.CORNum, tblEmployee.EID FROM tblEmployee LEFT OUTER JOIN rsTblClass_Students ON (tblEmployee.EID = rsTblClass_Students.EID) LEFT OUTER JOIN tblClasses ON (rsTblClass_Students.CLID = tblClasses.CLID) LEFT OUTER JOIN tblCourses ON (tblClasses.CORID = tblCourses.CORID) WHERE NOT EXISTS (select DISTINCT EID from rsTblClass_Students, tblCourses where tblEmployee.EID = rsTblClass_Students.EID AND tblCourses.CORID = 589 ) ORDER BY tblEmployee.ELastName
  7. Keith - thanks! It was a table naming problem Your confirmation that it looked okay made me look at other issues. This one worked: Select DISTINCT tblClasses.ClassDate, tblClasses.ClassID, tblClass_Students.EID, tblEmployee.Last, tblEmployee.First, tblClass_Students.Grade FROM tblClasses LEFT OUTER JOIN tblCourses ON (tblClasses.CourseID=tblCourses.CourseID) LEFT OUTER JOIN tblClass_Students ON (tblClasses.ClassID=tblClass_Students.ClassID) LEFT OUTER JOIN tblEmployee ON (tblClass_Students.EID=tblEmployee.EID) Where tblClasses.CourseID = $CourseID AND tblClass_Students.Grade LIKE 'P%' $ORDERBY
  8. I tried this: Select DISTINCT tblClasses.ClassDate, tblClasses.ClassID, tblClass_Students.EID, tblEmployee.Last FROM tblClasses LEFT OUTER JOIN tblCourses ON (tblClasses.CourseID=tblCourses.CourseID) LEFT OUTER JOIN tblClass_Students ON (tblClasses.ClassID=tblClass_Students.ClassID) LEFT OUTER JOIN tblEmployee ON (tblCourses.EID=tblEmployee.EID) Where tblCourses.SUID = $SUID AND tblCourses.CourseID = $temp AND tblCourses.Type_10 = '$active' ORDER BY tblClasses.ClassDate DESC But it doesn't work - the syntax is wrong - probably because I'm not joining the select table - and I don't know SQL well enough to know how to stitch it together. How would you write that join?
  9. Hi, this will be easy for anyone who knows SQL better than I. I have 4 tables. tblCourses tblClasses tblClass_Students tblEmployee There's a ClassID, CourseID, EID that links these together, and I can get a list of classes and dates using this SQL: Select DISTINCT tblClasses.ClassDate, tblClasses.ClassID, tblClass_Students.EID FROM tblClasses LEFT OUTER JOIN tblCourses ON (tblClasses.CourseID=tblCourses.CourseID) LEFT OUTER JOIN tblClass_Students ON (tblClasses.ClassID=tblClass_Students.ClassID) Where tblCourses.SUID = $SUID AND tblCourses.CourseID = $temp AND tblCourses.Type_10 = '$active' ORDER BY tblClasses.ClassDate DESC How can I get the employee names - tblEmployee.Last, tblEmployee.First? Or do I have to write a query within the query results? Thanks! B
  10. Timestamp datatype is stored in 8 bytes as binary( datatype. The timestamp value is automatically updated every time a row containing a timestamp column is inserted or updated. Timestamp value is a monotonically increasing counter whose values will always be unique within a database and can be selected by queried global variable @@DBTS. --- Example: Select Grade, ts From class_Students WHERE CID = '1677' results: Grade = P ts = V
  11. I'm hitting a SQL Server db and every table has a ts (timestamp) field that is a binary datatype - 8 bytes. Is there a way to "read" the binary and output it as a string?
  12. That's very close to what I'm trying to do. However, you say "If an HTML table is longer than the printed page" - how do you determine that? That's my problem. If I were using courier, I could calculate it, since all the chars are the same size, but if I have a lot of I's or a lot of O's, the size differs significantly, and I can't calculate it - I can only estimate with an 80% accuracy or so.
  13. I have a report that lists one to dozens of records, and I want to have a header and footer display on every printed page. The only way I can think of to do that is to somehow determine the height of the content in relation to an 8.5x11 sheet of paper - or is there another way? Since I'm not using monospace type, the report will vary if I just count characters. The report is displayed in a table format - is there any way to determine the table or cell height on the fly?
  14. litebearer - actually, you made me think about it, and NO - so you solved it for me. THANKS!
  15. I haven't used sessions much until now, so this is probably due to my ignorance. I have a page that sets the session variable, and if I print from that page, the session variable (an array) is correct. But when I move to the next page, the same session variable has old, old, wrong data. The $arrAttendeeList is an exploded list from a textarea on a form turned into an array. Example: This page, let's call it page1.php, sets the variable: <?php $_SESSION['arrAttendeeList'] = $arrAttendeeList; foreach ($_SESSION['arrAttendeeList'] as $temp) { print "$temp <br />"; } exit; ?> Results: Smithers, Waylon Bouvier, Selma Brockman, Kent But the next page, page2.php, when I call the same variable: <?php foreach ($_SESSION['arrAttendeeList'] as $temp) { print "<br />$temp <br>"; } ?> I get yesterday's data: Smithers, Waylon Bouvier, Selma I've tried setting the session var to null but with the same results. Do I need to kill the session var before setting it to something else? Thanks -
  16. So I could install Puppy Linux on an 8GB thumbdrive, create a disk image of c: and have the installation all there on the thumb? I'm liking it.
  17. I'm figuring someone knows whether it's possible or not. I want to install Windows - probably XP - configure it for my pc, then create a backup of the installation - as a backup to the system, and so I can just jam a new, clean image on the disk if I get a destructive virus. What's the best way to do this - and can I burn it to DVD? Is clonezilla the way to go? Thanks!
  18. I have discovered the source of the _hcc_thumbs directory that the GoDaddy scripts create. They are created by GoDaddy scripts by the GoDaddy File Manager, specifically, the File Manager web app at https://p3nlsccweb.secureserver.net which GoDaddy uses for its File Hosting Control Center. To reacreate this: FTP into a directory that contains a JPG image but no _hcc_thumbs directory. Confirm that the _hcc_thumbs directory does not exist. Log in to the account through GoDaddy account manager, and click on the File Manager. Navigate to the image in File Manager. The File Manager scripts create the _hcc_thumbs directory once you do that. The thumbnails are created to display 80px thumbnails in File Manager. Again, one-kunt finds it necessary to display his ignorance and pollute an otherwise useful forum with his thoughtlessness. I'm sure he's not done adding more of his preadolescent witlessness, but know that I won't be reading it. Have a nice day.
  19. one-kunt, instead of being a smartass, how about linking to anyplace where it's discussed and defined. It isn't. That's why I posted here.
  20. I've never seen this before, but now that I'm working on a GoDaddy site, I get this _hcc_thumbs directory any time I upload an image. GoDaddy support is clueless and claims it's something my FTP client does - LeechFTP. I've never seen it do that for 10 years. Anyone know where _hcc_thumbs comes from? I'd like to configure it, because it would be useful. It contains a thumbnail of all images uploaded, reduced to no more than 80px by 80px - and renames the file to filename.jpg-thumb-80.jpg.
  21. THANK YOU! I love this site.
  22. Alright - I spent most of the day wrestling with this one. I have 6 shifts of people that rotate through our training throughout the year. I need to list them by week of the year, and the shifts will usually start the year NOT on 1. For example: Week 1 - Week of Jan 04 = Shift 5 Week 2 - Week of Jan 11 = Shift 6 Week 3 - Week of Jan 18 = Shift 1 Week 4 - Week of Jan 25 = Shift 2 Week 5 - Week of Feb 01 = Shift 3 Week 6 - Week of Feb 08 = Shift 4 Week 7 - Week of Feb 16 = Shift 5 Week 8 - Week of Feb 22 = Shift 6 Week 9 - Week of Mar 01 = Shift 1 ...etc I was able to find the week of the year and the mondays, but I'm having a hard time matching the shifts with these dates. <?php $weekOfYear = "$year-$month-$day"; $weekOfYear = strftime("%W", strtotime("$weekOfYear")); $weekOfYear = $weekOfYear * 1; /////////// ///FIND MONDAY $todayIsMonday = ""; $findMonday = date('D', mktime(0,0,0,$month,$day,$year)); if($findMonday == "Mon") { $todayIsMonday = "<a href=\"events_shift.php?y=$year&m=$month&d=$day\">Shift $IneedToFindTheShiftNum</a><br />"; } ///FIND MONDAY ?>
  23. Nevermind: $shiftWeek = "$year-$month-$day"; $shiftWeek = strftime("%W", strtotime("$shiftWeek"));
  24. I have a date = 2010-03-26 and I wan to know what week number it is between 1 and 52. Seems like an easy thing, but I can't find it. Anybody know of an easy way? 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.