Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. PHP gets its input from form elements via the Get and POST arrays. You know that, don't you? Sorry - now I see that you are parsing this by reading some other script. So you are beginning to use the dom functions. Have you read up on examples of how to parse that document yet?
  2. How about reposting and using some punctuation, some proper code tags and breaking out the code from the text and EXPLAINING what it is you have done? Your current post is a mess to read and understand.
  3. And? Please don't make this so tedious.
  4. So - how long does a user have to respond to a challenge? Can he just ignore it or must he respond in a certain time? From what you say, you will have challenges stored in your db with a userid. That user logs in and runs a query script that pulls up a set of challenges containing his id. The script outputs a display of the challenges with enough info for the targeted user to decide what to do and he then clicks an Accept or Decline button next to that row's data.(An html table would be nice here.) Or you could just run the query for the oldest challenge and respond to it and then let the script produce the next challenge.
  5. How do the users know that they have to check for challenges? Are these challenges targeted at certain users only? So much you haven't told us.
  6. All very well and good Zane, but the point was to steer the OP towards a more proper "database" approach.
  7. What will you do with duplicate ip numbers? Kind of hard to prevent that with a text file as a database.
  8. 1. - Why a text file? Why not a db table? Do you paln on doing anything with this data? A table will be much easier to search thru. 2 - if you really want them on new lines, add a new line char. $crlf = "\n\r"; Add this var to your output when you do the write.
  9. What makes it modal if you don't have another script managing it? Sounds to me like just a hidden div.
  10. Taking a guess at what you want to do. Your anchor is calling a js function. That function s/b opening the modal window and calling a separate php script that populates it for you and goes away, leaving another script in the form tag of the modal window.
  11. Not even close. Sit back - think about your problem and if you don't realize something think about what might be wrong and show us the essential part(s) of that so we can follow the process. Not bits and pieces and no names nor relationships.
  12. Then why don't you show us THAT code instead of this blather?
  13. What is this modal link thing you speak of? What is $desc? What is $result?
  14. You could include a counter in the first solution and simply check if the row you are about to output matches the counter, the counter being the next expected value. If it is not a match, output the blank/empty row you want and then do the normal output of the currently fetched row. Of course if there are possible multiple missing items, this counter itself would have to be in a loop, inside your fetch loop.
  15. LovePHP: mysqli requires the variable type to do the bind using the ? parm. Therefore the OP's code is correct as it is. Mac_gyver has solved the user problem - no data was being fetched. And Mac_gyver has my vote on his choice of PDO over mysqli!
  16. When dealing with associative arrays, ie indices that you generate rather than php, you should always quote them. Even if they are numbers.
  17. So - did you look at your db table to visually see what the value of id was?
  18. You should still alter it to handle case sensitivity!!! Read The Manual!
  19. Perhaps if you turn on error checking you might get something that could help? Also - in that error message code consider echoing the actual command to ensure it is correct. Also - the syntax I just checked shows a space after each switch. Plus you are including a last parm that seems to be repetitive.
  20. The two auto-incrementing keys are completely independent. Don't see what your concern is. Personally, I avoid AI keys like the plague.
  21. Feeling magnanimous this morning let me throw in my $.02 and give you a little outline of what the previous responders are suggesting. 1 - define all of your questions (as you said) by subject/chapter/subchapter/unique Q#/ etc. 2 - design a table to hole #1 - one record per question with all of its identifying criteria. During this design phase, be sure you have all of the possible attributes you may need for each question down the road. Maybe a date added to keep track of older questions (outdate perhaps?) or other such things. 3 - define a table to define your users. A name, an id, contact info and any other attributes you may need for your testees. You will have a record for each person who takes your quizzes. 4 - define a quiz table that will contain a user id from #3, a quiz datetime, the key info from #1 for each question that is part of this quiz and a result field to track the user's score on each question. Here you will have a record for each question for each quiz for each user. Make sense? When all is done you will be able to pick a user, show how many quizzes he/she has taken, when it was done and what their score was. You can also track what questions have been used the most or have been used for this user. To create a specific quiz you do a query of your questions to select what you want to test on. If this selection needs to be trimmed to eliminate questions already answered in other quizzes, you will have to either add that to your query or loop thru the query results and create that array you were thinking of with the question key info and using some logic to drop the repeat questions. from that array. If you also want to shorten the list by using some random number selector you can do this against that array as step 2 of this process. Once you have modified your list of questions into table #4. Now you can output this as a complete quiz and then update it with the answers/scores when the user finishes. This is an outline, taking into consideration what I kinda gleaned from your initial post. Good luck!
×
×
  • 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.