mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
... 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....
-
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.
-
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?
-
Yes
-
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)
-
my bad... I didn't look your attachment. your INSERT ... what table is supposed to use... the same or other?
-
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)
-
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
-
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
-
will help if you tell us what exactly the problem is... what is not working?... any error message?
-
Getting multiple select instead of single (on JOIN table)
mikosiko replied to eevan79's topic in MySQL Help
the select that I gave to you is correct.... show us the rest of the code and example of the tables data -
Getting multiple select instead of single (on JOIN table)
mikosiko replied to eevan79's topic in MySQL Help
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 "; -
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
-
missing = after $ query $query = "SELECT *, DATE_FORMAT(news_date, '%M %d, %Y') as new_date FROM news";
-
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
-
MYsql select/where statements using in and and like
mikosiko replied to snorky's topic in MySQL Help
you also can search for examples here http://www.phpfreaks.com/forums/index.php/board,43.0.html -
MYsql select/where statements using in and and like
mikosiko replied to snorky's topic in MySQL Help
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 -
table alias like in ".... FROM users u .... " u is the alias for the users table
-
amount sold for the new artist compared with the MIN(sold) that you retrieve from your current table
-
in that case you should : - Select the record with MIN(sale)... compare it with your new record and proceed accordingly (NOTHING, DELETE/INSERT)
-
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
-
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 :-\