I am new to PDO, really new, I'm trying to read documentation from several site (, for example) but I just don't fully understand it.  Still, I wish to update an internal website I'm using in my company because this project is becoming bigger and important and I want to rewrite it to shape it better.  I was able to "convert":  &lt;?php $sql = "SELECT name FROM table order by name ASC"; $result1 = pg_query($conn, $sql); while ($row = pg_fetch_row($result1)) {   echo "&lt;option value='$row[0]'&gt;$row[0]&lt;/option&gt;"; } ?&gt;   to:  &lt;?php $sql = "SELECT name FROM table order by name ASC"; $stmt_menu = $pdo-&gt;prepare($sql); $stmt_menu -&gt; execute(); foreach ($stmt_menu as $row){   echo "&lt;option value=".$row['name']."&gt;".$row['name']."&lt;/option&gt;"; } ?&gt;   Even though I would have preferred to continue using the row[0] for simplicity, but Apache's logs complained about PHP Notice:  Undefined offset: 0 in /var/www/pdo-test-website/left-menu.php on line 20  Following other tutorials (like  one), I am trying to replace the current datalist SQLs into a PDO based statements.  Before I had:  &lt;input type="text" list="test_list" class="form-control input-sm" name="test_name" id="test_name_id" /&gt;  &lt;?php echo '&lt;datalist id="test_list"&gt;'; $test_name = pg_query("SELECT DISTINCT ON (FOO) FOO FROM table;"); while ($row = pg_fetch_row($test_name)) {   echo "&lt;option value='$row[0]'&gt;$row[0]&lt;/option&gt;"; } echo '&lt;/datalist&gt;'; ?&gt;   Now:  &lt;?php $datalist_foo = "SELECT DISTINCT ON (:value) :value FROM table;"; $stmt_datalist = $pdo-&gt;prepare($datalist_foo);   echo '&lt;datalist id="test_list"&gt;'; $stmt_datalist-&gt;execute(['value' =&gt; "FOO"]); foreach ( $stmt_datalist as $row ) {     echo "&lt;option value=".$row['FOO']."&gt;".$row['FOO']."&lt;/option&gt;"; } echo '&lt;/datalist&gt;'; ?&gt;   I am trying my best to have it working but I keep reading errors in the Apache's error log file. I tried rewriting this statement in many different versions, it would be not so useful if I would paste the log file for your reviewing because I should also write, for each error row, its full php code.  The last error, the one that I get after trying the code I posted above, is:  PHP Notice:  Undefined index: FOO in /var/www/pdo-test-website/datalist.php   I just want to note, that the non-pdo version works, the (test) database have data inside and I am able to fetch them using the "old" pg_query method.  I hope you can give me some advice, I also tried the solution at this link:  but I can't get it working.
Why can't I pass the table name to a prepared PDO statement?  $stmt = $dbh-&gt;prepare('SELECT * FROM :table WHERE 1'); if ($stmt-&gt;execute(array(':table' =&gt; 'users'))) {     var_dump($stmt-&gt;fetchAll()); }   Is there another safe way to insert a table name into a SQL query? With safe, I mean that I don't want to do  $sql = "SELECT * FROM $table WHERE 1"
Derivation of a generalization of Mertens' Third Theorem. One of Mertens' Theorems states $$\prod_{p\le x}(1-\frac{1}{p})\sim \frac{e^{-\gamma}}{\ln(x)}.$$ I have seen a generalized version that states  $$\prod_{m&lt;p\le x}(1-\frac{m}{p})\sim \frac{c(m)}{(\ln(x))^m},$$ where $m$ is a positive integer and $c(m)$ is a real number that depends on $m$. How can I derive this result? Is there a way to find what the values of $c(m)$ are? Thank you very much. There are $k$ penguins, $k\ge 3$. They are all different heights. How many ways are there to order the penguins in a line, left to right, so that we cannot find any three that are arranged tallest to shortest (in left to right order)? The penguin triples do not have have to be adjacent.  This problem is courtesy of someone I know only as "DaMancha." How does the built-in debugger decide what to highlight? Can I apply for a Schengen visa of the first port of entry or does it need to be the country of the longest duration? I'm planning to travel to the Netherlands, Spain and Bulgaria. My longest stay will probably be in Bulgaria. Now, Bulgaria doesn't issue a Schengen visa but allows people with a Schengen visa to visit. Which visa should I be applying for? Bulgarian Visa AND Schengen visa or just the Schengen visa for Netherlands or Spain? Why is the laboratory frame energy always greater than the center of mass frame energy? I have been looking for an answer to 'Why is the laboratory frame energy always greater than the center of mass frame energy during collisions?'.  A lot of resources provided mathematical explanations. I wanted to get some perspectives in terms of physics.  Could you explain this? let's imagine i am at school with an android phone. I have a computer at home and that computer has a virtual machine working on it. here is the scenario, client and virtual client has ssh-client and ssh-server both and they can communicate each other in the local network.  when i want to connect to my virtual client from school by android phone through internet there must be an ip address.  the problem is virtual machine and client has the same public ip. so how do i connect one of the two machines? Keep old kernels How can I rank observations in-group faster? Making separate Python installation that can call ArcPy? Today, we had a math class, where we had to show, that $a_{100} &gt; 14$ for  $$a_0 = 1;\qquad a_{n+1} = a_n + a_n^{-1}$$  Apart from this task, I asked myself: Is there a closed form for this sequence? Since I didn't find an answer by myself, can somebody tell me, whether such a closed form exists, and if yes what it is? I recently bought a new laptop with following configuration   CPU: Intel i5 2450 RAM: 8 GB DDR3 GPU: NVIDIA GeForce GTX 520 1GB   I've setup a virtual machine using VirtualBox with Windows 7 as guest. I want to use my (host's) graphics card in it but the virtual machine is only showing 128 MB of video memory.  I am using Bumblebee and start the virtual machine using   $ optirun VBoxManage startvm "Windows 7"   Please suggest me how should I use my graphics card for 3D acceleration in virtual machine. How do you generate all the permutations of a list in Python, independently of the type of elements in that list?  For example:  permutations([]) []  permutations([1]) [1]  permutations([1, 2]) [1, 2] [2, 1]  permutations([1, 2, 3]) [1, 2, 3] [1, 3, 2] [2, 1, 3] [2, 3, 1] [3, 1, 2] [3, 2, 1] I believe in Windows Vista, we could use linkd command. However, I cannot find this command in Windows 7. I know I can use Windows Explorer and delete the junction, but I wonder if this can be done in Command Prompt.  I can use mklink command to create a junction from a Command Prompt, so, what is the opposite of it (something like linkd)? I read a novel when I was 12 or 13 (late 80's, early 90's) about two timelines combining on Earth.  It was a full length novel for adults that I swiped from my mom (she doesn't remember it at all.)  I've been trying to figure out what the title is for some time but my google-fu is unable to find the right search terms.    The book was published in the 80's or perhaps early 90's.  The story: It was set on Earth and featured two timelines running concurrently (in the 80's?)  Timeline 1:  The nuclear missile crisis had gone badly and a low level nuclear war had more or less destroyed the US, but small towns still survived but are slowly fading away.  Much of the story was about the scarcity of goods, and the protagonist in the main thread of the book started the story by finding a 6 pack of Coke buried in a ruined house.  Throughout the story people were finding things that had grown scarce (deer, bullets, human beings.)  One strange scene I recall involved mutant/radioactive sweet potatoes that had driven a man insane.  Eventually people in this timeline began having dreams of their lives in Timeline 2.  Some of the people were not having dreams, and it was eventually discovered that they had died in Timeline 2.    Timeline 2:  There is panic in a world recognizable as our 1980's as nuclear war draws near.  Since more and stronger missiles have been developed, the end of humanity is at hand.  Things start disappearing from that world as the war begins.  Timeline 2 was mostly seen as vignettes of panicked people running around.  Combination of Timelines: In a weird, incongruous, almost surely poorly written scene, Gaia (yes, Earth itself) is seen to be combining a dying timeline with a doomed timeline in order to save humanity.  At the end of the novel, kids from Timeline 2 are transported into Timeline 1 in order to repopulate.  The new kids drink all the Coke, in case you were wondering...  Any help finding the title would be welcome.  I recall enjoying the book a lot when I was a kid, but I suspect my mom traded it in at our local used book store because at some point it just disappeared. Using ECDSA keys for encryption I know that ECDSA is used for signature only, but I wonder if I can use the public/private Elliptic Curve keys for encryption too.  I have ECDSA SSH public keys and I wonder if I can use them to encrypt data that only the matching machine could decrypt, writing the proper software.  Pointers welcomed. X,Y,Z missing in F3 When I press F3 to see the debug screen in I use Minecraft 1.8.1, some information is missing.   Most notably, there are no X, Y, Z coordinates.     What happened to my debug overlay? Break a previous commit into multiple commits Simple Past vs. Present Perfect: "was" vs. "has been" Possible Duplicate:          As a English non-native speaker it is difficult for me to understand when I must use present perfect or past simple because in my official language there isn't the present perfect tense. I know that present perfect is related to something that happened in the past but its result is important now. But for instance:        The message has been sent.   The message was sent.      Please help me point me out any examples/contexts where I should use 1. instead of 2. Sharepoint 2013. Add JS to NewForm.aspx of a list If $\mathop{\mathrm{Spec}}A$ is not connected then there is a nontrivial idempotent