mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
gotcha.... so.. my first answer was correct..... that is not possible to do that WITH A TRIGGER for this reason: "A stored function or trigger cannot modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger."
-
I feel your pain been there done that here is something that could help you http://www.elearningguild.com/research/archives/index.cfm?id=130&action=viewonly that is one of the good analysis about LMS's that I saw sometime ago. answer is complex as you know already... all depend on what functionality/standards are you looking for... also important to consider if you want the "free" alternatives or the commercial hosted ones (they are several with good functionalities). if you want to evaluate commercial alternatives take a look to http://www.intellum.com/learning-management.html .... we have been using this one for some years now and it works very well... but as I said... is going to depend of your objectives. hope this help
-
well... seems that you didn't read enough or you don't have a good understanding about how triggers work... which is ok.. we all started in some point (no offense intended) lets see... what you wrote was: DELIMITER ~ CREATE TRIGGER updTrgr BEFORE INSERT ON tester FOR EACH ROW BEGIN UPDATE tester SET tester.order = tester.order + 1 WHERE new.order <= tester.order; END;~ DELIMITER ; just look the code... and ask yourself - why if what I wrote is a BEFORE INSERT trigger I'm trying to UPDATE a row that is not there? (you are just inserting that row)... this doesn't make sense. seems that what you want to do is DELIMITER ~ CREATE TRIGGER updTrgr BEFORE UPDATE ON tester FOR EACH ROW BEGIN IF NEW.order <= OLD.order THEN SET NEW.order = OLD.order + 1; ENDIF; END;~ DELIMITER ;
-
sure it can be simplified... all your SELECT's can be reduced to just 1 SELECT play with this (not fully tested): SELECT `date`, count(`date`) AS daytotal, count(DISTINCT(`ip`)) AS singleip FROM `table` WHERE `date` between date_sub(curdate(), INTERVAL 7 DAY) and curdate() GROUP BY `date`; after that should be only a matter of loop thought the resulset and display the information. edited because I forgot the Group BY
-
I just posted the answer in other post "A stored function or trigger cannot modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger." http://dev.mysql.com/doc/refman/5.1/en/stored-program-restrictions.html
-
your trigger is wrong because you are trying to alter the same table upon the trigger is declared... that is not allowed "A stored function or trigger cannot modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger." read http://dev.mysql.com/doc/refman/5.1/en/stored-program-restrictions.html
-
URGENT - Server has locked my index file for overloading mySQL!
mikosiko replied to hedgehog90's topic in MySQL Help
too broad affirmation IMHO ... no always true.. depend on several circumstances. this worth to be read : http://www.mysqlperformanceblog.com/2006/09/01/order-by-limit-performance-optimization/ -
MySQL Query Problem Please i need your help...
mikosiko replied to gunesahmet's topic in PHP Coding Help
- check if you are really connected to the DB. - check the value of $seo_link before the query - what is $q... the one that you are using in your die() call? -
here is why http://www.php.net/manual/en/function.mysql-fetch-array.php read the paragraph "Return Values" you can change return mysql_fetch_array($info) for return mysql_fetch_array($info, MYSQL_ASSOC); or return mysql_fetch_array($info, MYSQL_NUM );
-
URGENT - Server has locked my index file for overloading mySQL!
mikosiko replied to hedgehog90's topic in MySQL Help
just read http://www.paperplanes.de/2008/4/24/mysql_nonos_order_by_rand.html -
Fenway... could you please point me where do you got that information? I just checked the 5.6 Manual and it say that the limit for a TEXT field can not exceed 2 to the power of 16 ie. 65536 bytes... and I did test it in my machine with version 5.1.44 and that is correct... a TEXT field cannot exceed the limit maybe I'm not seeing something relevant in the manual. thank you.
-
Not even remotely true -- that's VARCHAR you're talking about, as of mysql 5_. sure you are right... I was to drunk yesterday
-
Most likely one of your lines doesn't contain a '='
-
- table descriptions and how many records each? - Indexes / PK's ? - what your EXPLAIN PLAN shows?
-
type TEXT limit is 65535 characters you can change your field to a MEDIUMTEXT datatype for a maximum of 16777215 characters or to a LONGTEXT datatype for a maximum of 4294967295 characters
-
post your table description and what do you want to get
-
I will suggest to implement your categories - subcategories in a different and easy way Categories cat_id INT, cat_name VARCHAR, cat_parent INT for Master Categories the field cat_parent should be 0 or NULL for Subcategories the cat_parent field will point to the Master category (cat_id)... this should simplify your query.
-
.... [b] FROM image_school[/b] JOIN school ON image_school.school_id = school.school_id RIGHT JOIN image ON image_school.image_id = image.image_id [b] FROM school_course[/b] JOIN course ON school_course.course_id = course.course_id JOIN school ON school_course.school_id = school.school_id ORDER BY school_name"; $result = mysql_query($query, $conn) or die ("error retrieving course levels"); 2 times FROM ?.... I don't think so
-
drop/create table or truncate table will reset the autoinc.
-
$r = mysqli_query ($dbc, $q) or die(mysqli_error($dbc)); // Run the query and show the error on failure... Do not use the "@" in front... you have a blank space after mysql_query... delete it and try... $r = mysqli_query($dbc, $q) or die(mysqli_error($dbc)); // Run the query and show the error on failure... Do not use the "@" in front...
-
$q="SELECT horseID, total FROM enteredHorses"; $r = @mysqli_query ($dbc, $q); // Run the query. first: In your select (1st line) you didn't include the ORDER BY that I wrote in the code that I gave to you. second: re-write the second line in this way: $r = mysqli_query ($dbc, $q) or die(mysqli_error($dbc)); // Run the query and show the error on failure... Do not use the "@" in front...
-
yes... you are right... is a lot of examples in the net/forums to solve what do you want... basically your form should include all the possibles search criteria that allow you to filter the final query results... in some cases you can use form fields which values depend on the value of previous field and they are populated querying the database also. search around this forum and others and you will find examples.
-
please elaborate...
-
I don't get it... if I understand correctly what you are trying to do is: - Read your table EnteredHorses and depending on the value of the column "total" assign the proper "place" to the horse.... right? so.. why don't do that in this way : $q="SELECT horseID, total FROM enteredHorses ORDER BY total DESC"; $r = mysqli_query ($dbc, $q) or trigger_error(mysqli_error($dbc)); $place = 1; while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { $q = "UPDATE enteredHorses SET place = '$place' WHERE horse_id='".$row['horseID'] . "'"; $r = mysqli_query ($dbc, $q) or trigger_error(mysqli_error($dbc)); $place = $place + 1; } and even then, I will question why you need the column place if only with a simple select you can have the proper order, hence the horse's place.
-
If the two table have a clear relationship as in your case, I rather prefer to implement/enforce the Referential Integrity at DataBase level with a FOREIGN KEY and an ON DELETE CASCADE. In that way you only be deleting from the "Master" table PEOPLE... the ON DELETE CASCADE will take care of automatically delete from the PeopleCon Table.