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"; }
  6. I have a web form that has the user entering their email address. I've seen some common spelling mistakes and would like to fix those as I process the form data. It all works except when I'm trying to replace yahooo with yahoo. It stays as yahooo. I tried replacing yahooo with yahoo11 and I got yahoo11o. I tried replacing yahoo with 'thisisatest' and I got 'thisisatesto'. Is there something special about 'ooo'? So I tried searching for yahhhh, yahaaa and oooyaha and the program had no problems replacing them with yahoo (when coded for it). I've tried preg_replace and str_replace with the same results. Any idea what is happening here? Trial 1: $email = preg_replace('/yahooo/i','yahoo',$email); Trial 2: $email = str_replace('yahooo','thisisatest',$email);
  7. When I use the fgetcsv I get this. - thanks for the help. $fh = fopen("file.csv",'r'); $student = trim(fgetcsv($fh)); Error message is Notice: Array to string conversion on my second line.
  8. I'm trying to parse a csv file. The user sometimes enters commas into a field in Excel. Excel will then put quotes around that field that has commas in it when creating the csv file. Now my fields are all off because of these user entries with commas. I tried using an fgetcsv thinking it may handle this situation but I get an error with an "Array to string conversion" . How do I manipulate these lines that have commas within quotes in a csv file? $student = trim(fgets($fh)); $line = explode(",",$student);
  9. I have a php program that presents a form which is hosted on a secure site. Once the form is submitted, I have a "Continue" button to open a new browser window which is not on a secure site. When that happens Windows pops up a security warning with some scary text. Users have freaked out and thought the data they just submitted on the form was now seen by everybody on the Internet. I understand there are security settings in the different browsers and I'm guessing I have no control over those, but... how can I move from an https: site to an http: site without my users getting that warning box? How can I code my own pop-up message instead of the Windows pop-up?
  10. I have a web-based school registration program. One of the schools using it would like to let parents go to the computer lab on registration day and use their computers to register their child. This program collects some personal information. When the parent is done I would like to have a secure "log-off" script that prevents the next user from hitting the back key to reveal the previous information. I've explored some javascript that closes a browser but it only works for IE, Safari, and early versions of Firefox. Newer versions of Firefox purposely don't allow this (unless the page was opened with javascript which I now nothing about). I don't know javascript, I'd rather do something with php/html if possible. So, any brilliant minds out there have an idea? I hate taking away the back key feature (if possible) as that really restricts the users. Can I clear the browsing history so if I take them back to the log-in page and clear the history they have nothing to go back to? How do I make a secure log-off? Thanks, Steve
  11. I would like to spawn a new browser window but not have the browser buttons, address field, etc. Much like a pop-up but I want to avoid the pop-up blockers. Is there any way to do that or will I have to use a pop-up?
  12. I have a program for a client where their users reserve a timeslot (appointment). I would like to have the program send the user an email the day or two before the appointed time. I don't want to have the administrator of this program go in and run a function to send emails, if any, every day. I would like it to be automatic. But the only way I see this happening is to write a program that is an infinite loop that may pause for many hours at a time and then wake up and check to see if any have to be sent out. But then if the server ever goes down the program exits and someone would have to restart it. How do I get a program to run in the background and send periodic emails when it is appropriate?
  13. Thanks for the help. I found that the permissions on the folders were set for read only. Setting it to read / write would let me read the files. Still strange but it's working.
  14. I'm confused. I have a php program running on an Apache server (Linux) that works fine. The same code works fine using localhost on a Windows computer with IIS. I just got a Mac with Apache installed and it doesn't work with Safari using localhost. The error is that it can't read a text file in the same root directory (Sites) as the code. It says permission denied. I don't know my way around this Mac very well so I no idea where the error log is. I went into System Preferences and Sharing and enabled personal web sharing. I know Apache is running on the Mac. A simple helloworld.php program works fine. Any idea where I start? Thx
  15. Thanks, I found it. I had a little math problem.
×
×
  • 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.