I have PHP code that takes a XML file that is updated daily and  imports it into a MYSQL database. It was working fine until the other data I realized that players who have apostrophe with in their names weren't in the database. Below I listed the coding I am currently using and a XML example. Any help on this matter would be greatly appreciated  xml example of a player that uses an apostrophe in there name  &lt;player&gt; &lt;playername id="62583"&gt;Sa'Belle&lt;/playername&gt; &lt;allianceid id="729"/&gt; &lt;allianceroleid id="4749"/&gt; &lt;race id="2"/&gt; &lt;/player&gt;   Coding I am currently using       set_time_limit(0); // unlimited max execution time require_once 'kodadb.php';  function Unaccent($string) {     if (strpos($string = htmlentities($string, ENT_QUOTES, 'UTF-8'), '&amp;') !== false)     {         $string = html_entity_decode(preg_replace('~&amp;([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i', '$1', $string), ENT_QUOTES, 'UTF-8');     }     return $string; } function getGenDate($file, $elemName,$db) {         $count = 0;     // Open the file     $reader = new XMLReader();     if (!$reader-&gt;open($file)) {         die("Failed to open '" . $file . "'");     }     while ($reader-&gt;read()) {         if ($reader-&gt;name === $elemName) {             $count++;             $doc = new DOMDocument;             $node = simplexml_import_dom($doc-&gt;importNode($reader-&gt;expand(), true));                 $gendate = $node-&gt;datagenerationdatetime;                 return ($gendate);           }      }      $reader-&gt;close();      return ($gendate); }  function xmlReader($file, $elemName,$db,$genDate) {     $count = 0;     // Open the file     $reader = new XMLReader();     if (!$reader-&gt;open($file)) {         die("Failed to open '" . $file . "'");     }     while ($reader-&gt;read()) {         if ($reader-&gt;name === $elemName) {             $count++;             $doc = new DOMDocument;             $node = simplexml_import_dom($doc-&gt;importNode($reader-&gt;expand(), true));             $player['allianceid'] = $node-&gt;allianceid['id'];             $player['allianceroleid'] = $node-&gt;allianceroleid['id'];             $player['race'] = $node-&gt;race['id'];             $player['id'] = $node-&gt;playername['id'];             $player["Player_name"] = $node-&gt;playername;             if ($player['id'] !== null) {                 $sql = "INSERT INTO `players`(`player_id`, `Player_name`, `alliance_id`, `alliance_role_id`, `race_id`) VALUES ('" . $player['id'] . "','" . $player["Player_name"] . "','" . $player['allianceid'] . "','" . $player['allianceroleid'] . "','" . $player['race'] . "');";                 echo $sql."&lt;br&gt;";                 $db-&gt;query($sql);                 if ($db-&gt;connect_errno) {                     printf("Connect failed: %s\n", $db-&gt;connect_error);                     exit();                 }             }         }     }     $reader-&gt;close();     return($count); } $rustart = getrusage();  $db = doDatabase(); $sql = "TRUNCATE TABLE `players`"; $db-&gt;query($sql); $file = "./tmp/datafile_players.xml"; $elemName = 'server'; $genDate = getGenDate($file, $elemName,$db);  $elemName = 'player'; $numRows = xmlReader($file, $elemName,$db,$genDate); //echo "Inserted ".$numRows. " records into 'players'.";  function rutime($ru, $rus, $index) {     return ($ru["ru_$index.tv_sec"]*1000 + intval($ru["ru_$index.tv_usec"]/1000))      -  ($rus["ru_$index.tv_sec"]*1000 + intval($rus["ru_$index.tv_usec"]/1000)); }  $ru = getrusage(); echo "This process used " . rutime($ru, $rustart, "utime") .     " ms for its computations\n"; echo "It spent " . rutime($ru, $rustart, "stime") .     " ms in system calls\n";
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?
Sounds of supersonic objects Would you, as a stationary observer, hear a sound in reverse when the source of the sound travels with twice the speed of sound? Of course, he wouldn't hear anything at all before the airplane passed by and the sound reaches him, but what about after? Does it reverse due to the Doppler effect? I came across this statement while studying electric currents and I am confused:  "There is no electric field inside a conductor. Hence no current can flow through it".  Is there a fallacy in this statement?  Any help would be appreciated.  The conductor being discussed is ideal. What is the driving force for the current in this case? How can I instantiate a generalized hash function? I've come across a bunch of "strange" hash function notations, such as the following ones and now I don't know how to choose / instantiate them.  Can you please explain me what this notation means and how I can actually instantiate such a hash function?  The notation in question: $$H_1:\mathcal M \rightarrow \mathbb F_p$$ $$H_2:\mathcal M \rightarrow \mathbb Z_n^*$$ $$H_3:\mathcal M \rightarrow \{0,1\}^l$$ $$H_4:\mathcal M_1\times ...\times \mathcal M_k\rightarrow \mathcal S$$  where $\mathcal M\in\{\mathbb F_p,\mathbb Z_n^*,\{0,1\}^*,\mathbb G,...\}$ where $\mathbb G$ is a generic (but there instantiated) group and $\mathcal S\in\{\mathbb F_p,\mathbb Z_n^*,\{0,1\}^l\}$ Writing function definition in header files in C++ I have a class which has many small functions. By small functions, I mean functions that doesn't do any processing but just return a literal value. Something like:  string Foo::method() const{     return "A"; }   I have created a header file "Foo.h" and source file "Foo.cpp". But since the function is very small, I am thinking about putting it in the header file itself. I have the following questions:   Is there any performance or other issues if I put these function definition in header file? I will have many functions like this. My understanding is when the compilation is done, compiler will expand the header file and place it where it is included. Is that correct? Calculating proportional area of polygon within another layer's polygon using QGIS? About the semantically related words Google's algorithm uses in mixed language websites Because I'm Latin, sometimes I use a word in English while talking in Spanish.   In a website, for example, I could be interested in ranking for a word as “promoter” inside a page in Spanish, because that is how my public understands that concept.  Does the latent semantic indexing (LSI) (or whatever Google uses for semantic relation) fail to relate “promoter” with the content (because there are not related words in English) and then could that prevent my site from ranking? Nignx - worker_connections are not enough What documentation is needed for a tourist to drive a US citizen's car? Why do we use ./filename to execute a file in linux?  Why not just enter it like other commands gcc, ls etc... Self-promotion in chat We know from the  that it is accepted only in a limited way in answers and frowned upon if found to be spammy. We know from  that it can be deleted at any time from comments if the comment is not relevant or spammy.  But what about the chat? This leaves chat to be the only legitimate place to promote products or services that the user is affiliated to (albeit in an ad-like way).  What is your opinion? How to find creation date of file? I want to find out the creation date of particular file, not modification date or access date.  I have tried with ls -ltrh and stat filename. Detect if an outgoing call has been answered How do rich people guarantee the safety of their money, when savings exceed the FDIC limit? I am curious how a millionaire would guarantee the safety of his money, given that the FDIC only insures up to $250K of an individual's deposits at a bank.  If someone had $3 million that they wanted to put into the bank, would they have to open up 12 different bank accounts and deposit $250K into each one, so that all of his money is insured by the FDIC?  Or is there an easier way to guarantee the safety of all his money? IMO 1987 - function such that $f(f(n))=n+1987$ Show that there is no function $f: \mathbb{N} \to \mathbb{N}$ such that $$f(f(n))=n+1987, \ \forall n \in \mathbb{N}$$  This is problem 4 from IMO 1987 - see, for example, . A user just posted his question a second time here on meta after the first was closed as a duplicate. I wrote a comment on the second post, explaining that the answer to his question is in the linked duplicate and that he shouldn't circumvent the closure process by asking a second identical question.  When the second post was closed as a duplicate my comment was automatically deleted. As far as I understand this is a heuristic that removes obsolete comments, which it considers every comment that contains a link to one of the duplicates.  This heuristic is too aggressive and removes comments that go beyond "Duplicate here: link". I suggest that it should be changed to only remove the default duplicate comment, and not any comment that was edited by the owner nor any free-form comment that happens to include a link to the duplicate.  This also triggers for any comment that contains the word "duplicate" and link to any question, not only the question being chosen as duplicate, which makes this much worse. Notice: Undefined variable: logged in C:\xampp\htdocs\Site\Site\view_category.php Why did the limit of power change from wizard/witch to wand? So in the first 5 or 6 books, it was very clear that the wand chooses the wizard and the power/level of the spells the wizard produces is based on the knowledge and skill of the wizard.  This is referenced by people constantly being telling Harry that he wasn't skilled enough to perform certain spells, or Bellatrix telling Harry that he needed to mean the Cruciatus curse for it to be effective.  However, in the 7th book, this entire idea is changed to the wand being the thing that's powerful and regardless of the wizard's/witch's skill or knowledge, he/she could still perform a very advanced spell if it's something the wand could handle.  Goyle accidentally creating a fire serpent is something that instantly comes to mind from the movies(I don't remember if that happened in the book).  So, my question is, what actually holds the power, the wizard/witch, or the wand? How do I add polygons to fill a face? trying to recreate this Elijah bottle. I have two sides, one of which is outlined in red. How do I fill that face with polygons so I can then grab the center (that red square dot) to pull it outward thereby creating the slight outward bowing of the bottle? Duplicate questions in feed, and questions incorrectly marked as unanswered I see duplicate questions in the feed (Why is the book still wanted if Aida has memorized it?) and the question is marked as "unanswered" even though it has an upvoted answer.  I would expect unique questions in the feed, as well as questions with answers to not be marked as unanswered.   App Version: 1.6.3.4 Device: iPhone 6 OS Version: Version 10.2 (Build 14C92) I'd like to determine the function corresponding to the following power series: $$x + \sum_{n=1}^\infty (-1)^n\frac{1\cdot3\cdot5\cdots(2n-1)}{2\cdot4\cdot6\cdots2n} \frac{x^{2n+1}}{2n+1}, $$ where $|x|&lt;1$.