Jump to content

jmaccs64

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jmaccs64's Achievements

Member

Member (2/5)

0

Reputation

  1. jmaccs64

    NOW()

    I am hoping this would return all rows within the last 30 seconds... timestamp is in this format 2011-08-26 07:26:23 SELECT id FROM idtrack WHERE NOW() > timestamp > (DATE_SUB(NOW(), INTERVAL 30 SECOND)) its not... Thanks-In-Advance!
  2. I have this data set from a textarea P234324, 2011-03-23 12:34:37 \n P234434, 2011-03-23 13:34:36 \n P438794, 2011-03-23 14:34:36 \n P238924, 2011-03-23 15:34:36 \n I would like to explode it to this, but the multiple foreach is throwing me. $data['P234324'] = "2011-03-23 12:34:37" $data['P234434'] = "2011-03-23 13:34:36" $data['P438794'] = "2011-03-23 14:34:36" $data['P238924'] = "2011-03-23 15:34:36" Thanks in advance! Joe
  3. Can someone please tell me the right way to do this? $q = "SELECT * FROM scores WHERE student_id = {$student_id} ORDER BY test_type ASC"; $r = mysql_query($q) or die(); $r2 = mysql_fetch_array($r); $data[$r2['student_id']] = array( 'last_name' => $r2['last_name'], 'first_name' => $r2['first_name'], 'grad_year' => $r2['grad_year'] ); mysql_data_seek($r, 0); while($row=mysql_fetch_assoc($r)) { $data[testName($row['test_type'])] = array( 'eng' => $row['eng'], 'math' => $row['math'], 'read' => $row['read'], 'sci' => $row['sci'], 'comp' => round(($row['eng'] + $row['math'] + $row['read'] + $row['sci'])/4 ) ); } My Database Structure - All the different test-scores are in the same table, labeled with the test type &test-id.. id-student_id-last_name-first_name-eng-math-read-sci-grad_year-test_id-test_type 1-99999-smith-john-12-12-12-12-2012-1-3 I hope this makes sense! Thanks-In-Advance
  4. I am horrible at Regular Expressions, I have been reading the tutorials, but maybe I read too much... I simply need to match alphabet Last Names A-He This is what I have so far... '^[a-h]' Any Help? Thanks!
  5. Should this work? UPDATE acad_adv SET present = 1, teacher_complete = '$teacher_complete', comp_timestamp = '$time' WHERE acad_adv_id={$k} AND teacher_complete = NULL I think there is a problem, with the multiple WHERE statements... Thanks in Advance! Joe
  6. Hello all, My simple programing mind has led me to this implementation of a function. I work at a school, there are three different bell schedules one for Mon&Fri one for Tues&Thurs and one for Wed. I simply want to print on our homepage the time the current Period Ends. Here is what I have, it seems to work, but i am sure there is a way to do this with some while statements maybe even a foreach! Is there anyway someone can show me the error in my ways! Thanks in Advance! Joe <?php function getperiod(){ date_default_timezone_set('America/Chicago'); $mon_fri = array(725,810,815,900,906,921,927,1012,1018,1103,1109,1154,1200,1245,1250,1335,1340,1425); $tues_thur = array(725,813,818,907,912,1000,1005,1053,1058,1146,1151,1239,1244,1332,1337,1425); $wednesday = array(745,830,835,920,926,1011,1017,1102,1108,1153,1159,1244,1250,1335,1340,1425); $day = date('N'); $time = date('Hi'); // If it is Monday or Friday if (($day == 1) OR ($day == 5)){ if (($mon_fri[0] < $time) AND ($time < $mon_fri[1])){ echo "Period 1 ends at 8:10am";} elseif (($mon_fri[2] < $time) AND ($time < $mon_fri[3])){ echo "Period 2 ends at 9:00am";} elseif (($mon_fri[4] < $time) AND ($time < $mon_fri[5])){ echo "Period 3 ends at 9:21am";} elseif (($mon_fri[6] < $time) AND ($time < $mon_fri[7])){ echo "Period 4 ends at 10:12am";} elseif (($mon_fri[8] < $time) AND ($time < $mon_fri[9])){ echo "Period 5 ends at 11:03am";} elseif (($mon_fri[10] < $time) AND ($time < $mon_fri[11])){ echo "Period 6 ends at 11:54pm";} elseif (($mon_fri[12] < $time) AND ($time < $mon_fri[13])){ echo "Period 7 ends at 12:45pm";} elseif (($mon_fri[14] < $time) AND ($time < $mon_fri[15])){ echo "Period 8 ends at 1:35pm";} elseif (($mon_fri[16] < $time) AND ($time < $mon_fri[17])){ echo "Period 9 ends at 2:25pm";} else { echo "School Is Out!";} } // If it is Tuesday or Thurs elseif (($day == 2) OR ($day == 4)){ if (($tues_thur[0] < $time) AND ($time < $tues_thur[1])){ echo "Period 1 ends at 8:13am";} elseif (($tues_thur[2] < $time) AND ($time < $tues_thur[3])){ echo "Period 2 ends at 9:07am";} elseif (($tues_thur[4] < $time) AND ($time < $tues_thur[5])){ echo "Period 4 ends at 10:00am";} elseif (($tues_thur[6] < $time) AND ($time < $tues_thur[7])){ echo "Period 5 ends at 10:53am";} elseif (($tues_thur[8] < $time) AND ($time < $tues_thur[9])){ echo "Period 6 ends at 11:46am";} elseif (($tues_thur[10] < $time) AND ($time < $tues_thur[11])){ echo "Period 7 ends at 12:39pm";} elseif (($tues_thur[12] < $time) AND ($time < $tues_thur[13])){ echo "Period 8 ends at 1:32pm";} elseif (($tues_thur[14] < $time) AND ($time < $tues_thur[15])){ echo "Period 9 ends at 2:25pm";} else { echo "School Is Out!";} } // If it is Wednesday elseif ($day == 3){ if (($wednesday[0] < $time) AND ($time < $wednesday[1])){ echo "Period 1 ends at 8:30am";} elseif (($wednesday[2] < $time) AND ($time < $wednesday[3])){ echo "Period 2 ends at 9:20am";} elseif (($wednesday[4] < $time) AND ($time < $wednesday[5])){ echo "Period 4 ends at 10:11am";} elseif (($wednesday[6] < $time) AND ($time < $wednesday[7])){ echo "Period 5 ends at 11:02am";} elseif (($wednesday[8] < $time) AND ($time < $wednesday[9])){ echo "Period 6 ends at 11:53am";} elseif (($wednesday[10] < $time) AND ($time < $wednesday[11])){ echo "Period 7 ends at 12:44pm";} elseif (($wednesday[12] < $time) AND ($time < $wednesday[13])){ echo "Period 8 ends at 1:35pm";} elseif (($wednesday[14] < $time) AND ($time < $wednesday[15])){ echo "Period 9 ends at 2:25pm";} else { echo "School Is Out!";} } elseif (($day == 6) OR ($day == 7)){ echo "It's the weekend!";} } ?>
  7. I got it..... Thanks SELECT students.student_id, students.first_name, students.last_name, students.grad_year, acad_adv.assigned_resource, acad_adv.assigned_date FROM students INNER JOIN acad_adv ON students.student_id=acad_adv.student_id WHERE students.last_name LIKE '%smith%' AND acad_adv.assigned_resource = "1" AND acad_adv.assigned_date = "2010-05-08"
  8. This is directly from phpmyadmin SQL query: Documentation SELECT students.student_id, students.first_name, students.last_name, students.grad_year, students.grade_level, acad_adv.acad_adv_id, acad_adv.student_id, acad_adv.assigned_resource, acad_adv.assigned_date, acad_adv.present WHERE students.student_id LIKE '% smith %' OR students.last_name LIKE '% smith %' AND acad_adv.assigned_date = '05-08-2010' AND acad_adv.assigned_resource =1 AND students.student_id = acad_adv.student_id MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE students.student_id LIKE '% smith %' OR students.last_name LIKE '% s' at line 3
  9. It is not working, should I be using a left join? it says my syntax is wrong... Thanks in advance!
  10. Can someone please tell me what is wrong with this query... SELECT students.student_id, students.first_name, students.last_name, students.grad_year, students.grade_level, acad_adv.acad_adv_id, acad_adv.student_id, acad_adv.assigned_resource, acad_adv.assigned_date, acad_adv.present WHERE students.student_id = acad_adv.student_id AND students.student_id LIKE '%" . $name . "%' OR students.last_name LIKE '%" . $name ."%' AND acad_adv.assigned_date = $date AND acad_adv.assigned_resource = $resource Thanks
  11. As in a certain amount of time.....
  12. How can I make sure that a user does not hit reload after a script processes the information passed to it? So the script does not get executed again? Thanks....
  13. Thanks...that works... but there is one problem... Although each vote has a unique identifier.. if the person picks the same team twice in the same week, it only subtracts 1, from their vote count, when it should subtract 2....Is there any way to remedy this?
  14. Join two table users and surpool06 then based on a field in surpool06 subtract 1 from vote count on users... Does that make sense? 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.