Jump to content

ajoo

Members
  • Content count

    665
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ajoo

  • Rank
    Prolific Member
  1. ajoo

    inline to file.js

    Hi Guru Barand !! Thanks for that reply. It works great ! I would have replied earlier but i was busy trying out some other methods for the same purpose. your suggestion is perhaps the simplest. Thanks laods !
  2. ajoo

    inline to file.js

    Hi requinix & all ! Ok so i have tried a couple of things and I feel that the error that occurs is due to the fact that the variables <script type="text/javascript"> var myVal1 = "<?php echo $myVar1; ?>"; var myVal2 = "<?php echo $myVar2; ?>"; . . . myVar1 and myVar2 do not get passed into the external.js, JQuery file, if they are defined as is in the external,js file. So then how do i pass the php variable into the external.js JQuery file? If someone can help me with this, i think i would sort the rest. Thanks all !
  3. ajoo

    inline to file.js

    Hi Requinix, Thanks for the reply, May i request you to show me how to do it in the example above. Will be much obliged. Thanks.
  4. ajoo

    inline to file.js

    Hi all ! The following piece of code works fine. <?php $myVar1 = "best1"; $myVar2 = "best2"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>SWFObject 2 dynamic publishing example page</title> <!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> --> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> var myVal1 = "<?php echo $myVar1; ?>"; var myVal2 = "<?php echo $myVar2; ?>"; var flashvars = { myVar1: myVal1, myVar2: myVal2 }; swfobject.embedSWF("AS3_swf_php_comm_1.swf", "myswf", "550", "400", "9.0.0", false, flashvars); </script> </head> <body> <div id="myswf"> <h1>Alternative content</h1> <h2> Best </h2> </div> </body> </html> I wish to convert the following bit : <script type="text/javascript"> var myVal1 = "<?php echo $myVar1; ?>"; var myVal2 = "<?php echo $myVar2; ?>"; var flashvars = { myVar1: myVal1, myVar2: myVal2 }; swfobject.embedSWF("AS3_swf_php_comm_1.swf", "myswf", "550", "400", "9.0.0", false, flashvars); </script> into a file jquery file movie.js thereby removing the above inline code. Please can someone help me convert this or convert it for me. Thanks all !
  5. ajoo

    mysql error caused by the newer version

    Thank You Guru Barand for this wonderful answer. I will need to work on it to completely understand it though. Thank you !
  6. Hi all ! The following query gave no error earlier in version 5.6 SELECT mr.xid, fd.fname, fd.lname, fd.cell, fd.email, a.country_id, a.state_id, a.city_id, a.pin_id, sd.center_No, count(sd.fid) total, sum(case when sd.member_center_status='R' then 1 else 0 end) Acticount FROM master_recruitment as mr JOIN user_details as fd ON fd.user_id = mr.xid JOIN addresses as a ON a.fid = mr.xid JOIN member_details as sd ON sd.fid = mr.xid WHERE mr.mid = 6 GROUP by sd.fid, sd.center_No LIMIT 1, 10; gives the error : Expression #6 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mytestdb.a.country_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by; in version 5.7 of mysql. I have googled but could not really understand the reason the problem is occuring. Please help Thanks.
  7. 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 !
  8. 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.
  9. 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 !
  10. 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 !
  11. 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 !
  12. 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 !
  13. 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.
  14. 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 !!
  15. 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
×

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.