Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. it prints Resource id #x, because that's what the $bannedcheck variable is... a resource. You have to combine this resource with mysql_fetch_assoc, mysql_fetch_array, or mysql_fetch_row
  2. Update Firebug... and Firefox if you haven't already.
  3. group by p.pID then
  4. This may or may not be what you are looking for, but it should help you in the long run. SELECT p.pID, p.pName, p.poOptionGroup FROM prodoptions po INNER JOIN products p ON p.pID = po.poProdID WHERE p.poOptionGroup = 6 ORDER BY p.pName
  5. Once upon a time we tried to implement contests. We had judges ready, plenty of contestants, some decent ideas for difficult tasks.. but in the longrun, we were not able to afford decent prizes to give away. When we tried again a year or so later, there was no motivation to compete. So that idea was dead in the water until we could come up with actual prizes. I really doubt we will have any motivation to create a daily puzzle type thing. While it is a good idea, it involves dedication. If someone has any puzzles to post, they can post them in the Miscellaneous board. It would be excellent if that trend took off.
  6. I'm for locking them after x amount of months
  7. Have you tried grouping by referrer AND month? GROUP BY referrer, month
  8. You use references when you need to avoid the replication of variables. Typically, when you pass a variable to a function, it is within the scope of that function only, and you must return the desired variable to get what you want your function to do. When passing by reference, you are preserving the scope to that variable. It's much like when you order something with Fedex. When your package is received by Fedex, the don't go out and get a duplicate item to pass to the next branch. They send YOUR package throughout all of the branches until it reaches your door. If Fedex didn't "pass by reference", then your item would be received, put into a different box, perhaps even exchanged with a different yet similar item, and so on to each branch until it reached your door. Hopefully that puts things into perspective.
  9. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=354476.0
  10. I'm gong to lock this, it's getting out of control and the topic seems to be solved. There's no point in flaming for pages on end. If you overlooked it, thorpe threw out a some information for ya If thorpe has bothered you that much, the best you can do is ignore him. This is the internet, phpfreaks is not a business, and ultimately, we all have no debt to pay to anyone here. Thorpe has apologized, just let it be. BTW, I'm no peacekeeper in any way or form. If this were real life, I'd just let you argue it out until you both ran out of breath. I'm locking this because it is beyond the scope of "help" anymore. Also, in thorpe's defense, I have to point out that without him, phpfreaks would be down and/or empty right now. Of course that's no reason for sanctimony, but I definitely appreciate what he has done for the community.
  11. This is the point at which I fail at SQL. Just as in PHP, there is probably a miniscule error going on in the JOINing of these tables. I don't think I can be any more help than Google at this point. :shrugs: Since you've already made a troublshooting query, you should experiment with the different joins and see if you can figure it out. That's what I'd be doing right now. first I would eliminate the "INNER" portion on the INNER JOIN and see what yeilded with JOIN If that didn't work, I would start using OUTER JOINs until the troubleshoot query worked. LEFT OUTER JOIN OUTER JOIN RIGHT OUTER JOIN if I'm not mistaken though, I do recall fenway once saying that a left outer was the same as a regular outer... or cartesian.. or something. I could just be really wasted too.
  12. The easiest solution to this is to Google "valid email regex pcre" and see what comes up. Find and try every decent regex until one works the way you want. Somewhere out there in the intertubes lies the epitome of an email regex; one much better than you could probably ask for to be written.
  13. This may not be the problem, but it's the only thing that stands out to me. Is uid, in the a_child table, set as a VARCHAR variable? Why do you have 2 quoted? And how did the query not fail if you do have it set as INT?
  14. For this you would use an UPDATE query something like, UPDATE studentTopics stop SET stop.hoursSpent = stop.hoursSpent + 1 WHERE ... stop.topic = ? AND stop.student = ? If you wanted to add more topics, you would use an INSERT query like so, INSERT INTO topics `topicName`, `hoursReq`, `subjectID` VALUES ("Session 77", 25, 1)
  15. Alright then. Looks like you'll need to have a joining table for the students' topics instead. You should have a table for : students - would contain everything about the STUDENT subjects - would simply contain the subject name... and the primary key of course. topics - would contain every topic, along with subject id, description, and hours required. Then, for the joining table, you'd have - primary key - student id - subject id - topic id - hours spent Grabbing all that information would look something like this SELECT st.studentName, sub.subjectName, top.TopicName, top.hourReq, stop.hoursSpent, top.desc FROM studentTopics stop INNER JOIN students st ON (st.studentID = stop.student) INNER JOIN subjects sub ON (sub.subjectID = stop.subject) INNER JOIN topics top ON (top.topicID = stop.topic) Then. you could craft your WHERE statement however you'd like. For instance if you're looking for all students who have not satisfied the required hours.. you do WHERE stop.hoursSpent != top.hoursReq
  16. Overall, it seems to function well.. Slowly, but I guess it works. My main suggestion would be to find a better color scheme. Yellow on blue isn't that appealing and it clashes in your menu tabs. Check out http://colourlovers.com Select palettes from the Browse menu. Search for palettes based upon your main color, which seems to be blue. You can select it from the color grid or enter the hexidecimal code. Work with that.
  17. I can only assume that by "resizing" you mean to create thumbnails. An example/tutorial such as this should help you out http://webcheatsheet.com/php/create_thumbnail_images.php
  18. Ok, so from what I understand, every subject has a set amount of sessions, right? And each session has a set amount of hours required? It seems the real dilemma here is keeping track of the days, which I assume will just be stored as a UNIX timestamp or MySQL DATE formatted field. It seems to me that you would need a joining table that includes - the primary key id of the table - the id of the session - the id of the subject - the id of the student - the datetime of hours earned for said session - the number of hours earned for the said datetime.. I'm nothing close to an SQL expert so I'm pretty much just listing things right now. Am I on the right track here?
  19. "85% dropdowns" is not HTML code.. as for the $id, I have no idea where it even comes from because you haven't supplied any code for it.
  20. No, it's nothing more than me being funny. I figured it would help a little to use some humor in my explanation, but apparently not. I gave you more than enough information to get started. broccoli is only going to equal "burnt" if you set it that way in your form. I have a feeling you're using a bunch of checkboxes, so broccoli would most likely equal 1 or 0. But again, I have no idea what your HTML looks like.. so I have to resort to my own imagination.
  21. First off, you need your two main tables for: - students // This will include students' name, id, address, hours done, etc... - subjects // This will include the hours required, id, name, description, etc.. From the ids of these two tables you will create a joining table for whatever you need joined. So the next table would be for the subjects each student has. - studentsSubjects // This will have a field for tableID, student ID, subject ID As far as I have no idea what you need... what is a subtopic?
  22. Yes, there's a way to loop through them all without listing them separately. First of all though, avoid manually creating variables that only hold the value of another. $roastturkey = $_POST['roastturkey']; Has no benefit whatsoever other than aesthetics. Gee, now I only have to type $broccoli instead of $_POST['broccoli']... how l337!! That is a pointless concept unless you have calculations involved. You wouldn't pour your coffee from your coffee cup into another coffee cup just to add cream to it would you.... and then again for sugar? To loop through your inputs, you need to know two things. 1 - Do you want everything in $_POST? 2 - What don't you need from $_POST? ... Yes I realize those are the same, but a little repetition never hurt anyone. Using a foreach loop, you can grab EVERYTHING from $_POST and append it to a variable. For example, assuming you wanted EVERYTHING inside $_POST $myUpdateList = array(); foreach($_POST as $indexName => $value) { $myUpdateList[] = "$indexName = \"$value\""; } This will yeild an array containing all of your fields and their new values..Everything in that array will look something like this broccoli = "burnt" Now, the task is to take that array and implode it into a comma separated list.. $fields = implode(",", $myUpdateList); All that's left is the actual UPDATE statement now... and you have everything you need for it inside $fields UPDATE yourTable SET $fields WHERE id = $id Hope this helps
  23. There is nothing neat or professional about the code below. move_uploaded_file($_FILES['image']['tmp_name'][$i], WEB_UPLOAD."/images/galleries/g".$gid."/".$_FILES['image']['name'][$i]) or die("Error uploading image "); Professional ... and neat... code would be readable. The above code would be fine the way it is if you didn't want to strip the whitespace, but you do. Even though a professional coder may look at move_up..... and str_repl... and realize what's going on, you still have an abundance of single quotes, concatenation dots, slashes, and plenty of other things that could accidentally be deleted upon debug. I'm not saying to NEVER put everything on one line. My point is, that you came to a forum asking where to put str_replace in your own code (I assume it's your own code at least). There's is nothing neat about having no clue where to put that function. Take what I said and use your best judgement.
  24. Anytime you have an error like this That boolean is most likely FALSE. You would only receive a FALSE value in a mysql(i) function if the query failed.
  25. You say this yet... I'd consider that code. Even if it is HTML, it has every bit to do with how you craft your update This, I don't understand. You only need one loop.. and that is to loop through your input fields... your $_POST array.
×
×
  • 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.