Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. No problem, glad to help.
  2. adding in DATE_FORMAT(post_on, '%d') as day_to_group_by and then have a GROUP BY day_to_group_by at the end of the query.
  3. Dude, they are column names in a table called groups (or anything else you would want call it, use "sports", or "game_type" or something else if it's appropriate), they store the information that dictates what makes one group different from the rest. I'm only going to keep up with this so far because your ripping a hole out it now. It's genuinely about as simple as this : known physical elements can be in one of three states at room temperature - solid, liquid, gas - so rather than your concept of having a solid table, a liquid table and a gas table I say have an elements table which will have a field in it that holds stateID so PeriodicNo | ElementName | StateID 1 | Hydrogen | 3 then have a state table (this is the one that like the sports or group table) with the following StateID | State@RoomTemp 1 | Solid 2 | Liquid 3 | Gas See how that works?
  4. that is still running it in a loop, so if you have 50 ticket id's in that array you are hitting the DBS with 50 query requests, when you should be using only 1. As I don't have the first clue what you are doing this for, this is more of an extreme "catch all" solution for this type scenrio : (i'm assuming your working with id numbers here...) $record = array(); for($i=0;$i<25;$i++){ $record[$i] = $_POST['student']+$i.",".$_POST['subject']+$i; } $appendSQL = "VALUES "; $values = implode ('), (', $record); $appendSQL .="({$values})"; $sql = <<<SQL DROP TABLE IF EXISTS temp_table_update_dataset; CREATE TEMPORARY TABLE temp_table_update_dataset (studentID int, subjectID int); INSERT INTO temp_table_update_dataset (studentID, subjectID) {$appendSQL}; UPDATE studentbackup13 INNER JOIN temp_table_update_dataset ON (temp_table_update_dataset.studentID = studentbackup13.name) SET studentbackup13.code = temp_table_update_dataset.subjectID SQL; $performUpdate = mysql_query($sql) or die (mysql_error()); that's just off the top of my head, so it's likely not going to work without some refinement, but it will at least give you the idea of using a single query request rather than looping.
  5. you may want to edit that last echo there....
  6. that's why you have a user table and a group table, as I posted here already. user user_id name password group_id status etc. Group group_id group_name image_upload_count default_background_path etc. While you keep saying it's very unlikely that a user would ever change group, you are admiting that it is a possability and as such should be accomidated. This isn't about making things easy, if you want things easy you have the wrong passtime. This is about solving problems with the best solution that you can create. Using a relational database to store your information is effictivly pointless if you're not willing to learn how do do it properly. You would be just as well making static arrays in your code or using flat files on the server. The advice that has been given to you is designed to make your solution better. We don't activly seek to make life hard for people just for the fun of it. If you can open your mind and expand your point of view you can get a lot out of this forum, if you can't people are going to ignore you because lets face it - what's the point in trying to help someone who refuses to be helped? I'm going to take a last ditch atempt here : You only have a single user table because you only store the same information that is specific to each actual user. As you have different groups of user (lets keep with the basketball and soccer) you then need a single group table that will store the information that is specific to the group. Just because a users experiance is dictated by their group doesn't meen you creat a new users table for each group. what if you were designing a site that responded differently to people of a different height? You think it would be easy or efficient to make a table for every inch between 3 foot and say 10 foot? Honestly, 1 user table + 1 group table = the way to do this
  7. have you tried using another date_format to pull out only the day and use group by on it ?
  8. don't, it's very easy to miss the simple things when focusing on the complex parts of a problem, remember, even your boss didn't think of it
  9. any chance you wern't filling out either the expiery or the start dates in the form and that, as the same elements were being used with the same names one of these was overwriting the values of DOB with the innitial values?
  10. what's actualy in $_POST['action'] ?
  11. that's just weird, everything looks exactly like it should :/ I see you took out the date of expiery and date of issue, that was going to be my next suggestion, since all the elements would be named the same it would cause an issue. I assume that a var_dump($_POST) is still showing the wrong values in the dob field?
  12. images arn't much use, post the actual code, between code tags, and I'll have a look at it
  13. least you got the code tags this time You really should be learing SQL, this is seriuosly basic stuff. SELECT name, score FROM high_scores_avoidthecars ORDER BY score DESC LIMIT 50
  14. with the onsubmit gone and the $form instead of the include can you post the page source of the loaded page (page source it in the browser after it's been displayed) for index.php?
  15. change all instances of $preduzece-> to $this-> and remove $preduzece from between the parenthesis of the function decleration. Then I recomend you go do some more learning on classess and objects.
  16. see instead of including the select box form, build the $form at the top of the index page and echo it where you are including (I know it's a long shot, but i'm hitting the Holmes Process of Ellimination stage now) Etd: edited for typo
  17. that really doesn't help us much. take your time and break it down fully : what exactly are you trying to achieve? what is happening that should not happen? what is not happening what should happen? what code do you have that is relevent to this problem (post it up inside code tags)? what tables - if any - are you using and what is the structure of them? Once you have all that up then we will be able to help you properly. without it it's just guesswork and assumption - neither of which make for very good coding.
  18. what happens if you take off the onsubmit() JS call from the form and try it?
  19. can you post up the full form page?
  20. it's not recognising the fact that the select boxes are changing, try taking out all the selected="selected" from the code - select boxes default to the first value in them unless otherwise instructed, so you shouldn't need them in there and they may be part if not all of the problem.
  21. Because it's a gross and needless waste of resources and possably bandwidth, also in the event of larger more complex queires can result in bans from certain hosting companies (can be percieved as a DoS style attack) not to mention that in certain cases, when multitreading is enabled with a low simultanious connection limit, you can end up filling the connection limit with what should be a single transaction, locking out any other transactions. Edt : Oh, yeah, and there has only ever been a single occasion I have ever come accross where a looped query was required, and this is nowhere close to that.
  22. you would need to implode the array $datex = array($year, $month, $day); $datex = implode('-', $datex); make sure you swap the order around.
×
×
  • 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.