-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Posts posted by ginerjm
-
-
Actually you want to put the info into "different array elements", not different arrays. In your example code originally you were creating a new array each pass thru your loop. You should have used $ArrayY[] instead of just $ArrayY.
-
What are you beginning with? IE, what is $seconds defined as (int,str,datetime?) and what do you store in it? Since you are using a round function I can only assume that it is an integer. Therefore I would assume that you put some kind of unix time into it to start and therefore any date() function should output what you want or allow you to do math on it.
What have you tried so far?
-
Did you ever hear of a period when writing English? And what does orientated mean? Are you referring to oriented or are you referring to orientation?
-
The code you have posted is so disjoint that it makes it difficult to see what you are doing. I think I know what you want to do, and that itself is very simple, but the code you posted makes it hard to provide answers.
Look at it from our point of view. Would you understand if you didn't already know what you are doing?
1 - build the page for the user using your db data.
2 - let the user see the page and click on stuff
3 - handle the submitted page by grabbing the POST elements
4 - use the grabbed elements to run a query
5 - use the query results to build the results page.
That's the basic scenario
-
I'd remove the @ chars. Why would you EVER NOT want to know if those two statements failed for some strange reason?
There is some debate over the worth of the @ usage. I don't believe in it being used ever since hiding errors/notices is simply not the way to be a good programmer. If it's an error, handle it. If it's a notice, well, it is a notice and must be there for a reason so if you are aware of it, program around the reason for it.
- 1
-
Post your relevant code so we can see it.
-
Ok - now you have made yourself clear. If you re-read your OP you will see how it was confusing.
All you really want to do is to click on an item and have that sent to the server for handling. Ok - so you should have this listbox inside a form element and have a submit button for the form that triggers your script. In that script you grab the POST element for your list box (whatever the name= is in the select tag) and validate it to be sure it is correct and then use that value to search your db for whatever info you want to send back to the client in a new output arrangement.
Ok?
-
Moving on - Trying to figure out what your question is. For what purpose do you want to link your listbox to your database? I'm assuming that you already building the listbox by getting data from the database and looping thru some results to build the option tags. Why do you need a link to the database, or in other words, what are you trying to do once you have it built?
-
At least we agree on what a listbox is, but you say the user is entering a price into the listbox. How is that possible?
-
What listbox? People don't usually enter stuff into a listbox, so I'm curious what listbox you have that allows that
-
Simply add the other field to the displayed portion of the drop down.
$optionsHTML .= "<option value='$id'>$id - $label</option>\n";
(Note the removal of the unnecessary braces on your vars.)
-
That was not clear in your initial question. Very difficult to understand.
So how are you going to "query" for something that doesn't exist? Using your current query logic I don't see how you will have any of the "missing" records in your result set.
Perhaps you should create your output based upon the given date range by using PHP date functions to generate the necessary "work dates" and THEN populate those rows/dates using any matching query results within the range as I proposed.
Of course there will probably be someone who has a query-based solution, but that's how I would have approached the problem.
-
Why not simply test for dates > one date and less than the other (including equals as well)?
-
Echo out your query statements after building them and check them visually.
-
Fixing the function on #1 is key. Fixing the call on #2 is the other problem.
-
To quote you: 'testing purposes'.
The real point is - don't use urgent on forum posts. Do you really think we are all going to drop everything to help you out? The use of urgent just shows us who's new to the whole idea of forums.
-
Urgent? Really? And this code is just for testing purposes and it's urgent? Really? Urgent?
-
What is 'maxforumtopics.subject'. that is your problem.
-
So you got one problem working? The other you have an undefined var in your function call (the typo).
-
Also your error reporting put the 1 in quotes. Remove them.
-
Discard cycpher86's code and just study the original code. Re-read your second set of code until you see the typo you made. I already told you what had to change in the first problem.
-
So much for letting the student learn how to debug his own errors!
And the EASY correction was to simply move the return outside of the while loop! No need for code bloat.
-
Can we see your new code in its entirety?
-
My point was what happens when you turned on error checking? And did you find the glitch in your while loop that I pointed out?
mysql output into php arrary
in PHP Coding Help
Posted
Why do you unset those two row elements? They are not a bother to you.
As for the element creation you didn't follow my instructions. You LITERALLY s/b using $ArrayY[], not $ArraY[$two]. Your method is populating the element with index of whatever $two contains, not a new element for each book id.
And what is this use of those meaningless $one,$two,$three vars? What are they? And why is $three an array itself?