Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Kristoff1875

  1. Ignore this now, think i've found a solution with a completely different code! Thanks
  2. The bit I don't really understand: // Create the pile of shuffled cards var numbers = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; numbers.sort( function() { return Math.random() - .5 } ); for ( var i=0; i<10; i++ ) { $('<div>' + numbers[i] + '</div>').data( 'number', numbers[i] ).attr( 'id', 'card'+numbers[i] ).appendTo( '#cardPile' ).draggable( { containment: '#content', stack: '#cardPile div', cursor: 'move', revert: true } ); } And I was hoping in some way I could say something like: $result = mysql_query($query); echo "<div id='card". $row['CardID'] ."'>". $row['CardName'] . "</div>"; To show all the cards from a table with the ID's and names stored in the table.
  3. I've found this http://www.elated.com/res/File/articles/development/javascript/jquery/drag-and-drop-with-jquery-your-essential-guide/card-game.html which is very similar to what I want to do, however the DIV's used as code are generated in the jquery that I'm not too sure how to change to make it work how I want. Does anyone have any idea how I could pre populate these divs with a search in a MYSQL table instead and echo it as my foreach row statement? Thanks
  4. Thanks so much for your advice. I'm actually starting to understand it a little better now! At first the extra table made no sense, but now I've put it all in the database, I can see where it links together! Thanks again!
  5. Yep, each squad belongs to a user, sorry, I messed up my question and didn't ask it very clearly! I've solved it with this: <?php include("connect.php"); $query = "SELECT * FROM Squads WHERE TeamID = '4123' "; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($row as $col => $val) { $query1 = "SELECT * FROM Players WHERE PlayerID = '$val'"; $result1 = mysql_query($query1); while($row1 = mysql_fetch_array($result1, MYSQL_ASSOC)) { echo '<li><div class="playerhomeholder"><div class="player">'.$row1['Surname'].'</div></div></li>'; } } } ?> but i'm not sure if this is good practice?!
  6. I already have the players all stored in the Players table, but now these values are linking to a user's selection of players from the Players table. Would I need a new table for each user?
  7. I discussed this http://forums.phpfreaks.com/topic/277939-show-result-from-one-table-where-ids-match-on-another/ the other day, which Barand very kindly helped me solve... Now I have a new problem, with the same kind of issue. In addition to the tables mentioned, I have a "Squads" table. In this table, it has related values from the Players table. I have columns "Player1", "Player2" and so on up to 18. The first table column is related to the User's ID and the rest are player ID's that they've chosen. What I need now is for my search to return every column from 'Squads' where the 'TeamID' ties up, but I also need the player's name from the 'Players' table so that I can use it like so: $PlayerX being Player1, Player2, Player3 columns that have number values related to PlayerID in Player's table... Where $PlayerX from Squads == $PlayerID display $PlayerName I can get all of the player ID's to echo correctly, just not with the names. My last unsuccessful attempt was: SELECT s.*, p.Surname, p.PlayerID FROM Squads s LEFT JOIN Players p ON p.PlayerID WHERE TeamID = '$TeamID'"; Please tell me it's possible?! Many thanks!
  8. Many thanks Barand, made a few changes: SELECT p.* FROM Players p LEFT JOIN MatchdayScore m ON p.PlayerID = m.PlayerID AND m.MatchNumber = $matchday WHERE m.PlayerID IS NULL AND ClubID = $ClubID and works perfectly. Hope you're well buddy!
  9. Can't edit, so need to repost, sorry... Also need to search by ClubID from Players table if possible?
  10. Evening you clever lot on here! I'm sure this won't take long for you guys to give me some sterling advice! I have 2 tables, 1 which has matchday results on it, 1 which has player details on it. The ID's match up and tie in in the database, but on the page i'm on, I would like to display all the players that haven't got a value for this specific matchday. Important table layouts as follow: MatchdayScore PlayerID, MatchNumber 1234, 12 Players PlayerID, PlayerName 1234, Player One Each time a player plays a game, MatchNumber will have the relevant match number added for that player, so as you can see above, Player One (1234) has taken part in MatchNumber 12. I would like to add a search if possible to say something like: Select * FROM Players WHERE PlayerID AND MatchNumber NOT IN MatchdayScore So it only shows players who haven't got match 12 in MatchdayScore, but i'm not sure how i'd go about this? Any advice massively appreciated. Thanks
  11. I feel like such an idiot now. Lets just say, one of the if statements, was causing this error.... nothing to see here!!!!
  12. I have however just figured something out... login.php?clientid=1&jobid= sees the cookie fine... login.php?clientid=1&jobid=1 Doesn't see the cookie.
  13. Should it be something like: $year = time() + 31536000; if($_POST['remember']) { setcookie('remember_me', $_POST['username'], $year, '/', '.mydomain.co.uk'); } elseif(!$_POST['remember']) { if(isset($_COOKIE['remember_me'])) { $past = time() - 100; setcookie(remember_me, gone, $past); } }
  14. I've got a login script, all working fine, but i've recently added a remember me cookie: $year = time() + 31536000; if($_POST['remember']) { setcookie('remember_me', $_POST['username'], $year); } elseif(!$_POST['remember']) { if(isset($_COOKIE['remember_me'])) { $past = time() - 100; setcookie(remember_me, gone, $past); } } All works fine on the normal login page, however, when clicking on the email link with url variables in it: login.php?clientid=1&jobid=1 It can't seem to pull the cookie that recalls the username and ticks the box. Anyone got any idea why this could be?
  15. If you want it to look more like your original design, you can style the text box too.
  16. Earlier on it didn't get to the php page, it just loaded an error. I've just tried another and it's given the thank you message....
  17. Have you uploaded mailer.php?
  18. The submit button can be done in CSS or you can use: <INPUT TYPE="image" SRC="yourimage.jpg" WIDTH="x" HEIGHT="x" BORDER="0" ALT="SUBMIT!"> Where height and width are the size of the image.
  19. Also might want to hide your username and password...
  20. Ah perfect thanks. So if I needed to reference a table more than just calling from it the first time, I could say 'SELECT * FROM TableName A' and then use 'TableName A' to refer to it in future?
  21. Is this cleaner rather than using *? SELECT c.ClientID , j.JobNumber , j.Username , j.Description , j.ClientID , j.Status , j.AdminUnread , MAX(p.PostDate) as postedOn FROM Clients c INNER JOIN Jobs j ON c.ClientID=j.ClientID LEFT JOIN Posts p ON j.JobNumber=p.JobNumber AND c.ClientID=p.ClientID GROUP BY c.ClientID , j.JobNumber ORDER BY postedOn DESC, c.ClientID, j.JobNumber DESC Have also added in a few extra orders for the jobs with no posts.
  22. That's absolutely brilliant thank you so much. So if I understand it properly, running in order down the code, it says Call all from TABLE A > Only call certain things from TABLE B > Check if TABLE B has anything matching TABLE A in a certain column, discard anything that doesn't > Check if TABLE C has anything that matches any of the results that TABLE A and TABLE B sorted PLUS check and see if it matches the other value, if it doesn't then discard that too, then list all the results in the order requested? Does seperating the GROUP BY items with a comma mean that both values have to be there to group them? For example calling GROUP BY for just JobNumber would show only 1 JobNumber 1, and using ClientID would show only one of Client ID 12345's jobs, but by using both values it's showing all of that Client's jobs? You're an absolute star and that has been a massive help, hopefully I understood all that properly! As for your first point about not using * is that just an issue when calling from more than one table? Or an issue all the time? I notice lots of people using it and just assumed that it was an easy way of calling most of the columns from a table and the unused column values would just be discarded? Also, where the tables are called and the names seem shorter for example c.ClientID j.JobNumber where abouts is that set?
  23. I can't edit, but obviously the columns are called AdminUnread and Unread!
  24. And thought you may want to know, in the last 20 minutes, i've managed to set the unread icon next to the post! Added 2 columns to the Jobs table "Read" and "AdminRead" both with TinyINT (1). Added: UPDATE Jobs SET AdminRead = 1 WHERE ClientID='$clientid' AND JobNumber='$jobid' To the admin job detail page and the client alternative to their page, and when a new post is added it also updates the Jobs table setting the Read value to 0.
  • 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.