I'm trying to insert data into a mysql database using php. Seems like a simple task.  While using dummy data (just strings of text), it was working perfectly fine. And when I replaced the dummy data with the actual variables, I get this error:  ERROR: Could not able to execute INSERT INTO tbl_users (id, timestamp, testid, email, wants_newsletter, ip, country) VALUES (NULL, CURRENT_TIMESTAMP, , , , , ). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' , , , )' at line 1   Below is the script that I'm using. I am 100% sure that all the variables are working. I currently have them spitting out dummy data as well.  $testid = 1; $email = 'test@yahoo.com' $wants_newsletter = true; //get $ip if (!empty($_SERVER['HTTP_CLIENT_IP'])) {     $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {     $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else {     $ip = $_SERVER['REMOTE_ADDR']; } $country = 'US';  $user_id = 100;  $question = 14 $answer = 14      function saveToDB() {  /* Attempt MySQL server connection. */ $link = mysqli_connect("localhost", "$user", "$pass", "$db");  // Check connection if($link === false){     die("ERROR: Could not connect. " . mysqli_connect_error()); }  // Attempt insert query execution $sql = "INSERT INTO tbl_users (id, timestamp, testid, email, wants_newsletter, ip, country) VALUES (NULL, CURRENT_TIMESTAMP, $testid, $useremail, $newsletter, $ip, $country)";  if(mysqli_query($link, $sql)){     echo "Records inserted successfully.";     $user_id = $link-&gt;insert_id; } else{     echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }  // Attempt insert query execution $sql = "INSERT INTO tbl_answers (id, user_id, question_id, answer) VALUES (NULL, $user_id, $question, $answer)";  if(mysqli_query($link, $sql)){     echo "Records inserted successfully."; } else{     echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }  // Close connection mysqli_close($link);   }//end saveToDB  saveToDB(); //Call saveToDB()   I've been busting my head for hours trying to figure out this error. It might be something small that I'm overlooking and perhaps I need a fresh pair of eyes on it.  Any help would be greatly appreciated.
If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?
This is a  about using cron &amp; crontab.   You have been directed here because the community is fairly sure that the answer to your question can be found below. If your question is not answered below then the answers will help you gather information that will help the community help you. This information should be edited into your original question.  The answer for 'Why is my crontab not working, and how can I troubleshoot it?' can be seen below.  This addresses the cron system with the crontab highlighted. On my system (Windows Vista Home Premium 64bit) Python files are associated with Python interpreter:  C:\Users\Piotr&gt;assoc .py .py=Python.File C:\Users\Piotr&gt;ftype Python.File Python.File=c:\python\2.7\python.exe "%1" %*   Nevertheless when I run any Python script from command line a window titled Open With pops up asking me to Choose the program you want to use to open this file. How to find a whole word in a String in java Cross Browser Flash Detection in Javascript Does anyone have an example of script that can work reliably well across IE/Firefox to detect if the browser is capable of displaying embedded flash content. I say reliably because I know its not possible 100% of the time. Is it possible to export a single object from an entire scene? Sensor for detecting airsoft bullet I'm trying to make airsoft chronograph/chronometer (a device that measures airsoft bullet speed). The idea is to measure time in which bullet is traveling from point A to point B, and then I can calculate bullet speed. Bullet is shot into plastic pipe with diameter of 32mm. I've tried to put on one side IR LED and on the other side phototransistor (BPW 40), both at the start and end of the tube. Something like this:  Blue circles are phototransistors, red circles are IR LEDs and white circles are airsoft bullets. When bullet passes through area where bullet 2  is drawn (just in between IR LED and phototransistor), everyting works perfectly. But when the bullet passes where bullets 1 and 3 are drawn, it isn't detected. That is expected, but unwanted behavior. So my question is: how can I detect bullets regardlessly of it's position ? I've thought about putting IR LEDs and phototransistors around the pipe (not only in one place), like this:  but this solution isn't cheapest: 5 IR LEDs + 5 BPW 40 = cca $12 times 2 (because I need it on both sides of the pipe) = $24. Is there any cheaper solution ? Is BPW 40 good choice for phototransistor ? I don't know which IR LEDs I'm using (and salesman in the store also doesn't know - he told me these are generic ones for remote controllers, like TV or DVD controller). Diameter of the pipe is 32mm and it will be long about 14cm (sensors will be 10cm apart). Diameter of airsoft bullet is 6mm. EDIT: I'll go for my second idea. I just have one more question: is it better to arrange IR emitters and photo transistors this way:  or this way:  Thanks !! By considering:  $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^1}{n^{2}} = \frac 1 2$$ $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^2}{n^{3}} = \frac 1 3$$ $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^3}{n^{4}} = \frac 1 4$$  Determine if this is true: $$\lim_{n\to\infty}\frac{\sum_{k=1}^n k^m}{n^{m+1}} = \frac 1 {{m+1}}$$  If it is, prove it.  If it is not, evaluate $\lim\limits_{n\to\infty}\frac{\sum_{k=1}^n k^m}{{m+1}}$. How can I remove the BOM from a UTF-8 file? I have a file in UTF-8 encoding with BOM and want to remove the BOM. Are there any linux command-line tools to remove the BOM from the file?  $ file test.xml test.xml:  XML 1.0 document, UTF-8 Unicode (with BOM) text, with very long lines What could we call a person with deep knowledge in various fields? How does HOTP keep in sync? Why has it become an industry standard for logos to redirect a user to a website's homepage?   Where was this first seen? This is one thing that keeps bugging me, and maybe there's a direct answer. Grammatically, which one is more correct of these two?  Does it make a difference?  I tried not to do that. I tried to not do that. Probability that two random numbers are coprime is $\frac{6}{\pi^2}$ This is a really natural question for which I know a stunning solution. So I admit I have a solution, however I would like to see if anybody will come up with something different. The question is     What is the probability that two numbers randomly chosen are coprime?   More formally, calculate the limit as $n\to\infty$ of the probability that two randomly chosen numbers, both less than $n$ are coprime. Why can I not access a file named `-` when quoting? I have a file called -.  I want to display its contents.  One way is to do  cat ./-   since cat - reads from standard input. However, why are cat "-" and cat '-' also interpreted by the shell as cat -? This question is regarding the minecraft Beta 1.8 prerelease -- I have a beautiful house in single player survival which I'd like to record while flying.  I want to be able to change the game mode of my survival map to creative to be able to fly through it without installing a mod. I know it is possible if you run the map on a multiplayer server via the command /gamemode &lt;user&gt; 0|1 but I want to achieve this in single player :)  I think this would be possible through editing your level.dat file as I think that's where the game mode for the map is stored. How to delete directories with path/names too long for normal delete After updating to 2.81, my previous works (done in 2.80) doesn't show colors I have a corrupt tarball on my hands. My first attempt at recovery went like this:  $ tar --ignore-failed-read --ignore-command-error -xf tarball.tar tar: Skipping to next header tar: Archive contains ‘180738 0’ where numeric mode_t value expected tar: Archive contains ‘0.445647 -9.’ where numeric time_t value expected tar: Archive contains ‘.259273 ’ where numeric uid_t value expected tar: Archive contains obsolescent base-64 headers tar: Archive contains ‘-0.94874’ where numeric gid_t value expected tar: text from a text file is here: implausibly old time stamp 1969-12-31 18:59:59 tar: more text file contents are here: Unknown file type 'p', extracted as normal file tar: Skipping to next header tar: Skipping to next header tar: Exiting with failure status due to previous errors   This didn't extract much from the tarball before erroring out. The exit status is 2 which the tar man page says is a fatal error.  The documentation for "" suggested this:  cpio -F tarball.tar -i -v   This extracted 1.2G of a 1.8G tarball, which is pretty good. It stops with a bunch of garbage entered after the terminal prompt -- it isn't printed to the screen, it's as if I had typed it and didn't hit return yet.  Is there a way to do any better? Is there a way to try and "jump over the bad chunks" of the tarball?  With --ignore-zeros tar seems to be reading through the entire tar file.  tar -R --ignore-failed-read --ignore-command-error --ignore-zeros -xvf tarball.tar [...] block 3670356: ** Block of NULs ** block 3670357: ** Block of NULs ** block 3670358: ** Block of NULs ** block 3670359: ** End of File ** tar: Exiting with failure status due to previous errors   There are a lot of Block of NULs errors so it looks like the contents might be irretrievable. I have used the code shown below to draw a static CMOS inverter. I have tried to use the TikZ library calc to calculate the point at which drains of the PMOS and the NMOS devices meet; and the mid-point of the line which connects the gates of the two devices. Apparently calc gets the y coordinates of the points right. However, calc seems to get the x coordinates of the points wrong. What could I be doing wrong?  Here is the TikZ code:  \documentclass{standalone} \usepackage[americaninductors]{circuitikz} \usetikzlibrary{calc} \begin{document} \begin{circuitikz} \draw % Draw MOSFETs: (0,0) node [pigfete,yscale=-1,anchor=S] (M1) {} (M1.D) node[nigfete,anchor=D] (M2) {} (M1.G)--(M2.G) % The line connecting the gates of the MOSFETs. ; % Draw the power rails: \draw ($(M1.S)-(2.0,0)$) -- (M1.S) -- ($(M1.S)+(1.2,0)$); \draw ($(M2.S)-(2.0,0)$) -- (M2.S) -- ($(M2.S)+(1.2,0)$); % Input and output nodes: \node (I) at ($0.5*(M2.G)+0.5*(M1.G)$) {}; % The mid-point between the gates. \node (O) at (M1.D) {}; % The point at which the drains of the MOSFETs are conneted. % The Input and output lines. \draw ($(I)-(.8,0)$) -- (I); \draw (O) -- ($(O)+(0.8,0)$); \end{circuitikz} \end{document}   Here is the figure that I get: Note that that input and the output lines are not connected to the rest of the circuit. Can we attribute the problem of the lines not being connected, to the rest of the circuit, to the way I am using calc? SQL-Like Inner Join on IDs in Two Layers in QGIS Using QGIS v2.6.0-Brighton.  This question is not about editing layers geographically in anyway. It is merely trying to find data from two layers as you would in an SQL Query and append an extra ID to the second layer.  I have one polyline layer each identified with two different IDs. There is a point layer also with one of these IDs, I wish to find this corresponding ID and append them as a column to the point layer.  How do I do this without finding each row individually and typing it in manually (i.e. larger scale)? I would prefer to use SQL like syntax but if there is a GUI as well that would be ideal. Happy to install official plugins.