Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mikosiko

  1. ... you just know how to read the error This line: WHERE a.clan2 != b.clan2 AND a.matchno = '$ID'") has something wrong... can you spot it? (look the entire query ... compare with what I gave to you and you should be able to fix it....
  2. are you controlling the errors in your code? ... if you don't and your query is failing nothing is going to tell you what is wrong. at least you should have something like this (basic error control and stop the script) mysql_query("INSERT INTO ".PREFIX."cup_matches (clan1, clan2) (SELECT a.clan1, b.clan2 from ".PREFIX."cup_matches a, ".PREFIX."cup_matches b WHERE a.clan2 != b.clan2 AND a.matchno = '$ID'") or die("Query Error : " .mysql_error()); why you don't post the rest of your relevant code ?... in that way we can help you better.
  3. well.. because you introduced 2 news AND to the original query ... AND matchno = '$ID' would trigger a mysql error because it is ambiguous in the select... it should be AND a.matchno = '$ID' AND ($get_groups) No idea what it does therefore I can tell you that is will cause an error or not. In addition you didn't say if your other table's fields are required or not (NULL/NOT NULL) hence that could also trigger an error. probably you are getting a mysql error... what it say?
  4. Ok... this select should have done the same INSERT INTO table (clan1, clan2) (SELECT a.clan1, b.clan2 from table a, table b WHERE a.clan2 != b.clan2)
  5. my bad... I didn't look your attachment. your INSERT ... what table is supposed to use... the same or other?
  6. something is not matching up between your statements and your examples... you said: and your final example is letting out the first user of clan 2 (2627)... don't follow... you want all the combinations after let out the first Id of clan 2? .. if you want all the combinations this will do it INSERT INTO table (SELECT a.fieldclan1Id, b.fieldclan2id FROM clan1table a, clan2table b)
  7. Please post the new code that you have now. Did you review the comments that I did post before?... if you are maintaining the same code than before your errors still related to what I mentioned before. post your code again and will check.
  8. in this line $query = "UPDATE users SET last_visit_date = '$d', last_visit_time = '$t' WHERE username = '".$_SESSION['user']; you are missing a single quote at the end should be $query = "UPDATE users SET last_visit_date = '$d', last_visit_time = '$t' WHERE username = '".$_SESSION['user'] . " ' "; // spaces only for clarity
  9. just a simple debug to start... in your first code.... under this lines $sql = "SELECT * FROM users WHERE user = '$username' AND pass = '$password'"; $result=mysql_query($sql); add this echo "Rows : " . mysql_num_rows($result); and tell us what do you get
  10. will help if you tell us what exactly the problem is... what is not working?... any error message?
  11. just for a start: - You have several syntax/construction mistakes in your code. - Unbalanced {}'s... - Missing if clause and remaining of it still there (last else). - bad use of while(2 times)/do sentences... try to review your code and find the mistakes that I'm mentioning ...
  12. the select that I gave to you is correct.... show us the rest of the code and example of the tables data
  13. your JOIN is incorrect... it is not joining table friend_list with activities properly... it should be $sql = "SELECT " . $table_prefix . "activities.activities_id, " . $table_prefix . "activities.user_id, " . $table_prefix . "activities.other_id, " . $table_prefix . "activities.activities_date, " . $table_prefix . "activities.activities, " . $table_prefix . "friend_list.id, " . $table_prefix . "friend_list.user_id, " . $table_prefix . "friend_list.friend_id FROM " . $table_prefix . "friend_list LEFT JOIN " . $table_prefix . "activities ON " . $table_prefix . "friend_list.user_id = " . $table_prefix . "activities.user_id WHERE " . $table_prefix . "friend_list.user_id = $myid ORDER BY " . $table_prefix . "activities.activities_date DESC LIMIT 0,30 ";
  14. check if the extension is active using this <?php phpinfo(); ?> if is not try to restart your web server (apache?) and check that the extension_dir in your php,ini is pointing to the right directory and the php_mysql.dll is there
  15. missing = after $ query $query = "SELECT *, DATE_FORMAT(news_date, '%M %d, %Y') as new_date FROM news";
  16. no knowing exactly what problem are you trying to solve with that data model seems to me that you are trying to implement some kind of hierarchical thing.... this could give you some ideas http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
  17. you also can search for examples here http://www.phpfreaks.com/forums/index.php/board,43.0.html
  18. mixing IN and LIKE .... not possible as far as I'm aware of ... syntax for both clause are very clear. seems to me that you are looking to do something for what REGEXP is more suitable... look the examples and sure you will find the answer http://dev.mysql.com/doc/refman/5.1/en/regexp.html something like WHERE thiscolumn REGEXP "expr1 | expr2 | expr3... etc" where "expr?" is a formal regular expresion. hope this help
  19. table alias like in ".... FROM users u .... " u is the alias for the users table
  20. amount sold for the new artist compared with the MIN(sold) that you retrieve from your current table
  21. in that case you should : - Select the record with MIN(sale)... compare it with your new record and proceed accordingly (NOTHING, DELETE/INSERT)
  22. at first glance my answer would be the same than Nightslyr's but your quoted sentence specially the part that say "remain having 20 rows in the database" open the possibility of a different answer... - if you really want to display the highest 20 records from all the existent in your table Nightslyr answer is correct. - if you want to maintain in your table ONLY the 20 highest records that is a total different problem and solution which one you want?.... EDITED: just saw your answer
  23. I totally agree with you... but the OP doesn't understand it and apparently no willing to try... could be a good learning experience for him. and I don't want even mention his data model flaws ... that will make his head spin more :-\
×
×
  • 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.