Jump to content

ajoo

Members
  • Content count

    659
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ajoo

  • Rank
    Prolific Member
  1. ajoo

    rearrange dates in a DB table

    Hi Guru Barand ! Thanks loads for the reply. I want to actually update the existing records in my DB. SO its more like an update. But I think I should be able to take your reply and modify it for my purpose. Thanks a ton !
  2. ajoo

    rearrange dates in a DB table

    Hi Phi11W, Thanks for the reply. What I mean is that I want a uniform gap of 'n' days between two rows ( where n can be any one of 1,2,3 .. n), say 2 days. I want to automate this using either php or mysql. Further the time difference between TimeOfLogin and TimeOfLogout should also be uniform ( say 1hour ). I hope that makes the problem more clear. Thanks.
  3. Hi all, I have a set of dates as below: I wish to rearrange / UPDATE these dates in the DB to have a uniform gap between them like that of 1 or 2 or 3 or 0 or n days and a uniform interval of time ( 2 or 3 or 4 or 5 or n hours) between TimeOfLogin and TomeOfLogout. What would be the best way to achieve that? Should I i use php for this or is there an all mysql way to achieve this !! Thanks all !
  4. ajoo

    mysql output lost without a "word"

    Thank you Mac_gyver !! Well it was there for a fact but it was like this The quotes around E_ALL were screwing it up. I have been at it for almost a week. Can't thank you enough. 🙏 I am also getting a CSP policy violation error because of the following bit of code that controls the flash movie and is inline as <script language="javascript"> if (AC_FL_RunContent == 0) { alert("This page requires AC_RunActiveContent.js."); } else { AC_FL_RunContent( 'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '725', 'height', '578', 'src', 'moveit/glossy', 'quality', 'high', 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'align', 'middle', 'play', 'true', 'loop', 'true', 'scale', 'showall', 'wmode', 'window', 'devicefont', 'false', 'id', 'moveit/glossy', 'bgcolor', '#ffffff', 'name', 'moveit/glossy', 'menu', 'true', 'allowFullScreen', 'false', 'allowScriptAccess','sameDomain', 'movie', 'moveit/glossy', 'FlashVars', 'myVar1=<?php echo $myVar1;?>&myVar2=<?php echo $myVar2;?>', 'salign', '' ); //end AC code } </script> I would be so happy if you can tell me how to convert this into an external .js file and then invoke it from the code. I believe I have tried this earlier without success and also posted a question on the forum for the same. Once again thanks a ton Mac_gyver for the help !
  5. ajoo

    mysql output lost without a "word"

    Hi Mac_gyver ! Thanks for the response ! 1. PHP error reporting is already set to E_ALL. 2. The tables use InnoDB in both the machines. In fact the DB I have provided is a subset of the same DB in the old or new machine. 3. Correct. In fact the code does not reach the point where the commit is executed. However as you can see I used echo along to check the place where the mysql simply disappears. As indicated by the commented astrix (*) in the code, the code fails at the point immediately after the echoed query ( commented out in my code above) if($stmt->executed()) fails and the command echo "Generating Query"; is never reached. nor does it generate the subsequent echo in the else part of this block !!! So what's happening here !!?? 4. This one I am not sure I understand what you mean since I am not aware of the On DUPLICATE KEY UPDATE bit. But I will try and explain why what I am doing. As is seen, the code traverses this block for actually 4 times for 4 cases that occur serially at 4 different points of time. So Wrt_V_mistakes is always inserted and for the other 3 the table needs to be updated. 5. Correct, the posted output focuses on the queries. There is a lot of excess data but the data needed for the queries is available. The output shows RED ( in color) NULLs which should have numeric data if the query was successfully run. 6. I have a very simple exception handler that just gives a generic error message for development. I will check on this and revert soon. Thanks loads ! Ok so here is my handler set_exception_handler('exception_handler'); set_exception_handler('exception_handler'); function exception_handler($e) { // public message echo "Something went wrong.\n"; } I guess the error message that the exception throw is being ignored. Just the same message would also be good to indicate that an exception did occur. But in this case even this message does not show up. So i am totally lost as is the query output !😓 Thanks you !
  6. Hi all, My server config is as below Server version: Apache/2.4.18 (Ubuntu) PHP 7.0.30-0ubuntu0.16.04.1 (cli) ( NTS ) mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper I have this following bit of code. It runs up-to a point, indicated by the comments in code, and then vanishes totally. There is no error and there is no output either. I have display errors and mysqli reporting on and set as below: ini_set("display_errors",1); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqliDriver = new mysqli_driver(); $mysqliDriver->report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT; case "VS": $prestr = $sent_result[8]; $STATUS = $prestr."Status"; $SUMS = $prestr."Sums"; $PCT = $prestr."PCT"; $DPM = $prestr."DPM"; $TIMETAKEN = $prestr."TimeTaken"; $SPEEDDIGITS = $prestr."SpeedDigits"; $SPEEDSUMS = $prestr."SpeedSums"; $MODULE = $prestr."mistakes"; if($STATUS=='1'){ throw new Exception("VISUAL GADBAD"); } $v_sums_correct = $sent_result[1]; $v_time_in_seconds = $sent_result[2]; $v_delay_digit_ms = $sent_result[3]; $v_delay_sum_ms = $sent_result[4]; $v_dpm = $sent_result[5]; $v_pct = $sent_result[6]; $v_WA = $sent_result[7]; $con->autocommit(false); $commit_flag = true; $query = "SELECT EXISTS(SELECT 1 from vis_mistakes where UserLogin=? AND DayID = ?) as `mistakesCheck`"; $stmt = $con->prepare($query); $stmt->bind_param('si',$user,$dayNum); if($stmt->execute()) { $stmt->bind_result($mistakesCheck); $stmt->fetch(); $stmt->free_result(); if($mistakesCheck === 0) { // echo "MODULE : ".$MODULE."<br>"; echo "Inside Insert Mistakes<br>"; $query = "INSERT into `vis_mistakes` (DayID,UserLogin,$MODULE) VALUES (?,?,?)"; $stmt = $con->prepare($query); $stmt->bind_param('iss',$dayNum,$user,$v_WA); }else { echo "Inside Update Mistakes<br>"; $query = "UPDATE vis_mistakes SET $MODULE = ? WHERE UserLogin = ? AND DayID = ?"; $stmt = $con->prepare($query); $stmt->bind_param('ssi',$v_WA,$user,$dayNum); // OR die("Bound Fail Vis". $con->error); } // echo $no_of_logins." : ".$time_of_nLogin." : ".$v_sums_correct." : ".$v_pct." : ".$v_dpm." : ".$v_time_in_seconds." : ".$v_delay_digit_ms." : ".$v_delay_sum_ms." : ".$date." : ".$RecNo."<br><br>"; // echo "<br>".$SUMS." : ".$PCT." : ".$DPM." : ".$TIMETAKEN." : ".$SPEEDDIGITS." : ".$SPEEDSUMS." : ".$STATUS."<br><br>"; // ********** // vanishes beyond here ******* !!!!!! if($stmt->execute()) { echo "Generating Query"; // ********* does not display this echo ************* // $query = "UPDATE mysessdata SET no_of_logins = ?, time_of_nLogin = ?, $SUMS = ?, $PCT = ?, $DPM = ?, $TIMETAKEN = ?, $SPEEDDIGITS = ?, $SPEEDSUMS = ?, $STATUS = 1, TimeOfLogout = ? WHERE RecNo = ?"; $stmt = $con->prepare($query); $stmt->bind_param('isiddsiisi',$no_of_logins, $time_of_nLogin, $v_sums_correct, $v_pct, $v_dpm, $v_time_in_seconds, $v_delay_digit_ms, $v_delay_sum_ms, $date, $RecNo); echo "<br>"; echo $query; echo "<br>"; if($stmt->execute()) { echo "<br>Query executed<br>"; $query = "SELECT $SUMS,$TIMETAKEN,no_of_logins,$SPEEDDIGITS,$SPEEDSUMS FROM $table WHERE RecNo = ? AND $STATUS = 1"; $stmt=$con->prepare($query); $stmt->bind_param('i',$RecNo); if($stmt->execute()) { $stmt->bind_result($vsc,$vtt,$no_of_logins,$VDS,$VSS); $stmt->store_result(); $stmt->fetch(); $stmt->free_result(); $arr_result =array($datatype,$vsc,0,$vtt); // echo "<br>vsc = ".$vsc; // server_mod // echo " vtt = ".$vtt; // server_mod // echo " Visual Record Updated. <br>"; // server_mod // echo " Visual Speed Digits = ".$VDS; // echo " Viasual Speed SUMS = ".$VSS; } $con->commit(); $con->autocommit(true); } else { // ** does not even print this, the else from above !!!!!! // echo "<br>MeesUP"; throw new Exception("ERROR : 1-V"); } }else throw new Exception("ERROR : 2-V"); }else throw new Exception("ERROR : 3-V"); if($commit_flag===false) { mysqli_rollback($con); throw new Exception("Visual"); } echo " exiting"; break; SNAPSHOTS OF MY DATABASE The NULL values should be changed (updated or inserted). The output from running the above code is as below : The database file, just in case :😊 -- MySQL dump 10.13 Distrib 5.7.22, for Linux (x86_64) -- -- Host: localhost Database: mysessdb -- ------------------------------------------------------ -- Server version 5.7.22-0ubuntu0.16.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `mysessdata` -- DROP TABLE IF EXISTS `mysessdata`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mysessdata` ( `RecNo` int(11) NOT NULL AUTO_INCREMENT, `UserLogin` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, `Level` tinyint(4) NOT NULL, `SessionStatus` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `TimeOfLogin` datetime DEFAULT NULL, `Wrt_W_Sums_R1` tinyint(4) DEFAULT NULL, `Wrt_W_Sums_R2` tinyint(4) DEFAULT NULL, `Wrt_W_PCT` float(10,2) DEFAULT NULL, `Wrt_W_DPM` float(10,2) DEFAULT NULL, `Wrt_W_TimeTaken` smallint(6) DEFAULT NULL, `Wrt_W_Status` tinyint(4) DEFAULT NULL, `Wrt_V_Sums` tinyint(4) DEFAULT NULL, `Wrt_V_PCT` float(10,2) DEFAULT NULL, `Wrt_V_DPM` float(10,2) DEFAULT NULL, `Wrt_V_TimeTaken` smallint(6) DEFAULT NULL, `Wrt_V_SpeedDigits` smallint(6) DEFAULT NULL, `Wrt_V_SpeedSums` smallint(6) DEFAULT NULL, `Wrt_V_Status` tinyint(4) DEFAULT NULL, `Wrt_O_Sums` tinyint(4) DEFAULT NULL, `Wrt_O_PCT` float(10,2) DEFAULT NULL, `Wrt_O_DPM` float(10,2) DEFAULT NULL, `Wrt_O_TimeTaken` smallint(6) DEFAULT NULL, `Wrt_O_SpeedDigits` smallint(6) DEFAULT NULL, `Wrt_O_SpeedSums` smallint(6) DEFAULT NULL, `Wrt_O_Status` tinyint(4) DEFAULT NULL, `TimeOfLogout` datetime DEFAULT NULL, PRIMARY KEY (`RecNo`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `mysessdata` -- LOCK TABLES `mysessdata` WRITE; /*!40000 ALTER TABLE `mysessdata` DISABLE KEYS */; INSERT INTO `mysessdata` VALUES (1,'mina12345',1,'1','2018-01-13 16:48:26',4,0,20.00,45.00,16,1,4,80.00,9.35,77,2500,5000,1,4,80.00,11.43,63,2500,2500,1,'2018-01-13 17:48:26'),(2,'mina12345',1,NULL,'0000-00-00 00:00:00',1,20,43.00,18.00,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); /*!40000 ALTER TABLE `mysessdata` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `vis_mistakes` -- DROP TABLE IF EXISTS `vis_mistakes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `vis_mistakes` ( `SNo` bigint(11) NOT NULL AUTO_INCREMENT, `UserLogin` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `DayID` smallint(11) NOT NULL, `Wrt_V_mistakes` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `Mtl_V_mistakes` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `Mul_V_mistakes` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `Div_V_mistakes` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`SNo`) ) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `vis_mistakes` -- LOCK TABLES `vis_mistakes` WRITE; /*!40000 ALTER TABLE `vis_mistakes` DISABLE KEYS */; INSERT INTO `vis_mistakes` VALUES (1,'mina12345',1,'3,',NULL,NULL,NULL),(2,'ranveer09',1,'4,5,',NULL,NULL,NULL),(35,'mina12345',2,'2,3,',NULL,NULL,NULL); /*!40000 ALTER TABLE `vis_mistakes` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-07-24 12:27:22 Strangely this very code works just great on my old machine where the mysql version is 5.6 php is 7.0.27 and almost the same apache version. It simply does not display or log any errors. I am totally stumped. Gurus Please help !! Thanks all !
  7. ajoo

    if (empty()) not working for me

    Hi Benanaman, is this a big issue ? Could you please explain the difference & the advantage of one over the other? Thanks.
  8. Hi Requinix, No, there is no recommend link at the bottom near the quote. The check would be just fine. What's required is an indication that the problem is solved or had a best reply. So I guess the checks would do the job well. You know, the main reason I think this feature was not used is that often, there is more than one reply to fit the best category and the user is in a quandary regarding which to select as the best. Happened with me so many times. Even in this very question. Lol !!, Your reply was correct but Gizmola's provided a deeper insight & got me thinking. All the best for your new idea !! Thanks !!
  9. Hi, It however does not show up in the list of topics to indicate that a topic is answered and closed. Wish you could do something about that too ! Thanks
  10. Hi requinix, I do have a recommended link at the top of the page. and there's a Featured Link , like a star in a down arrow, on Gizmola's post. So how do we do it ?? This would serve nicely to show that the topic is answered and closed ! Thanks !
  11. I think this feature was really great since one could save tons of time by simply focusing on looking for a solution from answered questions instead of going through each & every similar question. Further it let one zoom down directly to the correct answer in the thread ! really sad ! Thank you.
  12. Hi Gizmola & Requinix, Thanks for the inputs. You were correct, both that is. There was a path error in the xsendfile module. Gizmolas reply set me thinking. I cannot find the button that would set this thread as solved with a best reply else I would do so. Thanks again !
  13. Hi all ! I hope someone can check my last thread of this topic and offer some advise. Thanks all !
  14. Hi requinix and all ! So here's my related question that I mentioned in the last mail. I have 2 VPS's identical in all respect and working. In the first VPS, my /var/www folder is organized as follows: and in the 2nd VPS as There is a folder called images inside the aboveroot1/(2) folders in both VPSes. This stores images of the registered users and is mostly there for the purpose of editing, though not by the user but by an admin. folder permissions on images in both VPSes is drwx-wx---- or (730) while the file permissions are -rw-rw--- ( 660 ). While VPS1 displays the pictures from images folder just as it should, in the form, VPS2 fails to do so. I suspect that the 2nd method is the right way of setting up symlinks and that VPS1 is exposing the aboveroot1 folder as publicly accessible. If my assumption is correct and I go the VPS2 way, then, how do I display the picture files from inside the images folder? Can i do that by changing permissions on the folders OR would i have to expose the images folder and bring/move it from inside the aboveroot1(2) to under the webroot ? I hope i could explain my issue clearly and look forward to your replies and suggestions, Thanks all !
  15. Hi requinix, Long time ! I hope you are good. The actual error was really dumb. I had not changed the https port 443 back to 80 in the conf file of the new server where there was no SSL certificate. So that seems to be a configuration mismatch. However I do have a related question which I will ask later since I am trying out a few things to be a little bit clearer or sort it altogether. It has to do with symlinks. I'll come back later. Meanwhile this issue is sorted. Thanks loads.
×

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.