-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
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.
-
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.
-
All very well and good Zane, but the point was to steer the OP towards a more proper "database" approach.
-
What will you do with duplicate ip numbers? Kind of hard to prevent that with a text file as a database.
-
Huh?
-
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.
-
What makes it modal if you don't have another script managing it? Sounds to me like just a hidden div.
-
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.
-
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.
-
I give up.
-
Then why don't you show us THAT code instead of this blather?
-
AGAIN - what is this modal thing?
-
What is this modal link thing you speak of? What is $desc? What is $result?
-
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.
-
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!
-
When dealing with associative arrays, ie indices that you generate rather than php, you should always quote them. Even if they are numbers.
-
So - did you look at your db table to visually see what the value of id was?
-
You should still alter it to handle case sensitivity!!! Read The Manual!
-
case sensitive?
-
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.
-
Mimicking autoincrement primary key using PHP
ginerjm replied to NotionCommotion's topic in MySQL Help
The two auto-incrementing keys are completely independent. Don't see what your concern is. Personally, I avoid AI keys like the plague. -
Give users random subsets of questions from different "chapters"
ginerjm replied to wee493's topic in PHP Coding Help
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! -
if you turned error reporting you could see the error message
-
I'm looking forward to your first sample of your own written code....
-
If you are writing a function to pull one column at a time and plan on using it to repeatedly pull different columns from your database, that is truly a poor use of resources. Do not plan on pulling data one column at a time.