Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Kristoff1875

  1. My Races Table, note RaceID 50000 https://www.dropbox.com/s/vwha17y80h9kgw8/Screenshot%202014-03-31%2019.47.13.png This is my Results table which did have data that tied up with the other tables, such as RaceID 50000 did show up, but now all related values have vanished. Here is the browse tab: https://www.dropbox.com/s/1t6m9gcu0cj52vx/Screenshot%202014-03-31%2019.48.01.png Here is select all search: https://www.dropbox.com/s/902xthpzgvusq9l/Screenshot%202014-03-31%2019.49.26.png
  2. They're all integers and the ones that aren't visible are all linked from other tables , yet all the other tables display the values fine.
  3. Not sure what's caused it, but on one of my tables, all of the related values all seem to be invisible? https://www.dropbox.com/s/vqtgw0az44isu1t/Screenshot%202014-03-31%2019.22.51.png When calling results it displays them properly and when running a search they all display, just not in the browse tab. Anyone got any ideas? Cheers
  4. Guys would you be able to shed any light on my next problem? In the results table i've got a UserID appearing twice, each one has it's relative finishing result, for example 1 and 5 for first and fifth. Have you guys got any idea on how I should calculate those in to a total of points? For example If first position received 10 points, second received 9 and so on, to calculate the total points?
  5. Just a quick one then if you could... How would I go about making each result unique? For example so that only 1 User can finish in 3rd place per race, and so that each UserID can only be in each result once? Ignore that, think i've done it now.
  6. You're both right... I actually had it planned out like that and I'm trying to implement it wrong! Many thanks for pointing out my stupidity!!
  7. I have a few tables: Results, Races and Users. Users has "UserID" indexed, Races has "RaceID" indexed and the plan was to use Results to grab it all together. Issue is each Result has 24 places and I wanted to call the user ID's for each position, so P1 and then link it to a UserID all the way to 24. When trying to do this though i'm getting the error: Too many key parts specified; max 16 parts allowed Does anyone have any idea of how I can get around this?
  8. Perfect thank you, you're a star. Amazing how something so simple can throw you off in such a way!
  9. Ok, I think I understand why it's returning 1 row, because it's seeing that the user exists, but not any transactions. So the result does exist, but the transactions don't... Gazumped now though as I don't know how to check for results that match both.
  10. There's no transactions currently, but there are users, but there can't be any transactions by the logged in user as there are no transactions at all. Sorry, when I said no rows in the table I meant no rows related to the query, although there are no rows in transactions.
  11. There are no rows in the table at all, so it can't return anything, yet it is saying the result is 1.
  12. $row_cnt = mysqli_num_rows($result); echo $row_cnt; while($row = $result->fetch_array()) { } It's echoing number 1 and also showing 1 row with blank values and 01/01/1970 as the date.
  13. Hi guys, trying to make the move to MySQLi and some of it is baffling me. Quick question as my query is currently saying there's 1 result even if there isn't one... How do I go about finding the number of rows returned for this: $sql = <<<SQL SELECT u.*, t.* FROM Users u LEFT JOIN Transactions t USING (UserID) WHERE UserID = $UserID ORDER BY Date DESC LIMIT 5 SQL; Thanks in advanced!
  14. It's not actually check boxes, the values are from DIV's being set as selected when clicked. I also gave up with the extra errors and added a standard error message as they shouldn't be able to get to that part anyway.
  15. Ah, so simple! Thanks. Is there a way to check for the: Message and then use a custom error message? I'm searching google for this currently, just thought I'd ask here too. Thanks again for your help! ------------ Ok, so it's this part: if($db->query($sql) === false) { trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $db->error, E_USER_ERROR); } else { PRINT "Inserted"; } Showing the error, so can I break this down in to different error pages?
  16. The BoxID can only be selected once on each SaleID. I'm working on making the selection process disable on the front end, but want to double it up so if it does somehow happen, they definitely can't add it to the database and get an error.
  17. Is there a way of making sure the row with the same BoxID doesn't exist in the database already? Would that be something to do with unique?
  18. Could you guys point me in the direction for this by any chance? I have the value of boxes selected being passed as: box1,box2,box3 But no matter what I do, I can't seem to get this to insert to the database with a foreach statement. Here's what i've got: $Selected = $_POST['Selected']; $Selected1 = explode(',', $Selected); $Selected2 = implode(',', $Selected); $v1="'" . $db->real_escape_string('UserID') . "'"; foreach($Selected as $Selection){ $sql = "INSERT INTO Selected (BoxID) VALUES ('$Selection')"; I've tried any mixture of these, including foreach($Selected1 as $Selection) and foreach($Selected 2 as $Selection) but don't seem to be getting anywhere. Anybody got any pointers for me please?!
  19. So if one person got 5 boxes, I'd have to insert each one as a unique row as: UserID, SaleID, BoxID Makes sense I suppose as I would then say something like: SELECT * FROM BoxesTaken WHERE SaleID = XXXXX To show all of the boxes that have been taken?
  20. Nope, i'm talking more backend stuff. The idea is, depending on which SaleID is opened by the user, the page then calls all of the already taken boxes from the database and assigns them to the boxes on the site and as such says "This one is taken" and even if they try to choose it, it won't let them. What I am more meaning is as you say, double checking that they aren't somehow trying to add a box that someone else already has. Obviously that shouldn't be an issue if the UI works correctly, but just as a precaution!
  21. Hi guys, before I get to the main part of my question, I first wanted to ask whether there is a maximum number of values you should store in an array. If for example you have 5000 boxes that people can choose from and eventually all 5000 boxes will be chosen, is it save to store all of the chosen boxes in an array? For example box1,box5,box7,box21 are already chosen, then someone chooses box2,box3,box4 and it adds to the same array, is that feasible with up to 5000 values in total? My thoughts on it were that it would probably be more feasible than giving each box it's own column!? Secondly, assuming the above is ok, how would I go about ensuring nobody could choose a box already chosen? Basically, if somebody chooses box3 and box4, how can I check that these don't exist in the column before adding them so they don't duplicate? Hope this makes some sense and isn't just gobblydeegook! Finally, if somebody in the Users table chooses box3 and box4 from SaleID5, what would be the best way of storing what they've chosen in the User table to use the data when they're viewing what they've got?! Many thanks in advance guys.
  22. Just noticed a typo of the extra = symbol. Should be: if (!empty($row['OneDel1'])){ $OneDel1 = 1; }
  23. Well, what i'm inputting is this: Option One Delegate 1 Name: Example1 Delegate 1 Email: Example1@eg.com Delegate 1 Position: Manager Delegate 2 Name: Delegate 2 Email: Delegate 2 Position: Delegate 3 Name: Delegate 3 Email: Delegate 3 Position: Which I was then sending to a unique row, in to the following columns: OneDel1 -> Example1, Manager OneDel1Email -> Example1@eg.com OneDel2 OneDel2Email OneDel3 OneDel3Email I'm storing the position with the name and for the purpose it's been serving, it's been working fine. But now I just need to check and see which of the columns of the selected row are empty so I can total them up.
  24. One piece of data per row? Do you mean rather than having OneDel1 OneDel2 etc, to use OneDel and store them in there as an array? The problem with that for me is that for each OneDel there is also an OneDel1Email and OneDel1Position (number changes for each) and some rows may only have 1 piece of data for each, some may have 4.
  • 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.