Jump to content

stevepatd

Members
  • Posts

    27
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

stevepatd's Achievements

Member

Member (2/5)

0

Reputation

1

Community Answers

  1. Sorry to have bothered you all. I figured it out. Instead of using a variable for each column of the database I can use the $row array after the mysqli_fetch_array. That makes it really sweet. I really appreciate this site and all the effort you experts put into answering our questions.
  2. I have a database table with 52 values (one for every week of the year). The column names are Week1, Week2, etc. When processing this I would like to use a 'for' loop from 1 to 52 and create something like this: for ($n=1; $n<=52; $n++) { $variable = '$Week' . $n; if ($variable == something) { do the thing; } }// for then if the value in that weeks cell matches the expected value I do my thing. How can I dynamically create my "variable" that is the name of the variable so I can test the value of it? I don't want to write a little snipet of code 52 times to see if $Week1 == something, $Week2 == something......
  3. This is for setting up parent teacher conferences. Sometimes they will set up one 'day' as the morning, then the second 'day' as the afternoon of the same day as that morning session. I want to merge the two getting rid of the hidden timeslots and keeping the ones that are open to schedule. I wish they wouldn't do this but instead of giving them an error message I would rather handle it. Thanks for the help, it seems to be working now.
  4. I allow duplicates since the administrator can double book, I want to do the cleanup in the backend. I gave some thought to having an integer index like you show but thought I could get away without it. I will add that. The table will eventually have data from several schools so I do have a column for SchoolID. Will your approach allow me to keep the data from other school buildings intact? Thanks for the help, I will give this a try.
  5. I am trying to delete some rows that are duplicate, or almost duplicates, from a table. I've spent too many hours trying different approaches and researching this and have to ask for help. From the test "print" statement I put in, it never gets inside the if statement, I never see "I am here" on the screen. Not that it matters but I'm using php. From the attached picture of my database table, I want to delete the lines, with red arrows, that have duplicate dates/times that have the word 'hide' for the Code. If both similar lines have 'hide' for the code then I only want one, remove the other (thus the Limit 1). Any help is appreciated. Thank you. $remove = "DELETE FROM teacher_schedule WHERE (Code='hide') ORDER BY DateTime LIMIT 1"; if (@mysqli_query ($connection,$remove)) { print "I am here"; }
×
×
  • 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.