-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
List categories by type and list subcategories by order
ginerjm replied to afaaro's topic in PHP Coding Help
Why not simplify your whole logic and simply do the query with an order by clause and then output it using the while loop on your query results? -
Don't understand your logic for having this kind of setup. Can you give us some background before we waste time giving you a possible solution that turns out to be unusable? Sounds like you have a commerce site where you want to monitor multiple shopping carts for one user. That doesn't seem right.
- 10 replies
-
- 1
-
- session
- auto increment
-
(and 1 more)
Tagged with:
-
Session_start is most likely the culprit. I wouldn't go so far as to recommend it in every 'include' file, but it does have to go near the start of every script that you pass control to. If you are using a header() command to trigger your members script, then definitely you need a session_start at the top of that one. It's simply a good habit to put it at the beginning of every independent script you write.
-
Does one really need a "PDO framework"? PDO is pretty simple to understand, and requires only a few statements to use. It's a set of functions that does everything you need. What will a framework accomplish for you that your own code can't do? Guess I never understand why people here are always looking for ways to encapsulate a basic feature of web development with some 'tool' (framework in this case, object/classes in others) when the standard php language promises so much. You write a statement and prepare it, then you assign your parameter values via either a bind or an array to be used in the execute() call and then you loop thru the results with a simple while calling a fetch. Oh - and the connection is a short set of code that you write once and store off-root and include wherever it is needed. Just my $.02.
-
Having now seen your duplicate posting (!!!) I will offer this.. 1 - as was already mentioned, turn on error checking. (See my signature) 2 - Where you try to insert a record you reference the $image var. That has not been defined. And what exactly are you trying to store in your db - an image file name? Did you ever save the uploaded file someplace? I don't see any code for that. And since you never assigned a value to $image, you're probably getting an error but not seeing it displayed.
-
You should really elaborate on what you need help with. What exactly isn't right in your mind?
-
Assuming that the questionnaire contents are in a table which contains not only the questions but the title and a date field that you can call "release_date". Set that field to be the date you want it to be available and maybe have another field to close it so that when the page is called for and you query your db you select only those who have a release date and close date within your current window of time, ie, release <= today and expire >= today.
- 3 replies
-
- questionnaire
- php
-
(and 2 more)
Tagged with:
-
Define 'released'. Available for public perusal? Define '1/2 week'. Are you counting by days hours or seconds?
- 3 replies
-
- questionnaire
- php
-
(and 2 more)
Tagged with:
-
So - your while loop echos out both li tags for each row that is returned. Why? (And I've never seen a list used in such a way as to contain 6+ divs, two imgs, a p and an a tag as well as whatever else is in all that html.) If you only want one li per row, then only echo one li per row. Use a switch mechanism to alternate which one is used if that is what you are saying. Try: while...... { ... ... if ($alpha) { echo (the alpha li tag) else echo (the li tag w/out alpha) $alpha = !$alpha; } ... ... }
-
Huh?
-
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?
-
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
-
Setting user levels when logging in with sessions
ginerjm replied to T1hom7as's topic in PHP Coding Help
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. -
Setting user levels when logging in with sessions
ginerjm replied to T1hom7as's topic in PHP Coding Help
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.