I'm trying to bind two parameters to a prepared PDO select statement. This is what I have so far:  $query = "select * from books where ? LIKE ?"; $result = $db-&gt;prepare($query); $result-&gt;bindValue(1, $searchTerm, PDO::PARAM_STR); $result-&gt;bindValue(2, "%$searchValue%", PDO::PARAM_STR); $result-&gt;execute(); $rows = $result-&gt;fetchAll(PDO::FETCH_ASSOC); print_r($rows);   This executes successfully but I don't get any rows returned.  But when I use only 1 param  $query = "select * from books where title LIKE ?"; $result-&gt;bindValue(1, "%$searchValue%", PDO::PARAM_STR);   I get rows returned. I've checked 1000 times for my param values and names and they are fine.  I don't understand why this doesn't work with two params. Please advice.
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"
How to delete files listed in a text file Why won't Smart UV Project automatically unwrap a simple chair? I created a very simple chair mesh and I would like to unwrap it so that I can map a texture. I would like to have Smart UV Project unwrap it automatically, but whether I do it that way or try manually, I am unable to unwrap the model.   Is there something I'm missing?    I tried a few guides, but I'm not sure where I'm going wrong.  My File: How to change the date format? Presently the date is showing as mmm dd hh:mm:ss. Is there any way that I can change it to as per my liking. For example : dd mmm, hh:mm:ss. How can I SELECT rows with MAX(Column value), PARTITION by another column in MYSQL? My table is:     id home datetime player resource     1 10 04/03/2009 john 399   2 11 04/03/2009 juliet 244   5 12 04/03/2009 borat 555   3 10 03/03/2009 john 300   4 11 03/03/2009 juliet 200   6 12 03/03/2009 borat 500   7 13 24/12/2008 borat 600   8 13 01/01/2009 borat 700     I need to select each distinct home holding the maximum value of datetime. Result would be:     id home datetime player resource     1 10 04/03/2009 john 399   2 11 04/03/2009 juliet 244   5 12 04/03/2009 borat 555   8 13 01/01/2009 borat 700     I have tried: -- 1 ..by the MySQL manual:   SELECT DISTINCT   home,   id,   datetime AS dt,   player,   resource FROM topten t1 WHERE datetime = (SELECT   MAX(t2.datetime) FROM topten t2 GROUP BY home) GROUP BY datetime ORDER BY datetime DESC  Doesn't work. Result-set has 130 rows although database holds 187. Result includes some duplicates of home. -- 2 ..join  SELECT   s1.id,   s1.home,   s1.datetime,   s1.player,   s1.resource FROM topten s1 JOIN (SELECT   id,   MAX(datetime) AS dt FROM topten GROUP BY id) AS s2   ON s1.id = s2.id ORDER BY datetime   Nope. Gives all the records. -- 3 ..something exotic:   With various results. 3 questions about Algebraic Geometry and Zariski topology I've read this exercise on my book, but I don't know how to prove it... Can someone help me?  Let X $\subseteq \mathbb{A}^n$ be an algebraic set, and $f, g:X\rightarrow k$ two regular functions.  a) If we see $f$ as an application $X \rightarrow \mathbb{A}^1(k)$, prove that $f$ is continuous in the Zariski topology.  b) If $X$ is irreducible and an open $U \subseteq X$ exists such that $f_{|U} = g_{|U}$, prove that $f=g$.  c) Give an example of $X, f$ and $g$ such that $f \neq g$ but $f_{|U} = g_{|U}$ in an open $U \subseteq X$.  Thank you!  For b) I have been able to prove that:  Let E be the subset where $f = g$ so E is closed (Why? I know that $E = (f,g)^{-1}(\Delta_{k})$ but... why is $(\Delta_{k})$ closed?). So $U \subseteq E \Rightarrow \bar{U} \subseteq \bar{E}=E$ (beacuse E is closed) $\Rightarrow X \subseteq E$, because $\bar{U}=X \Rightarrow E = X$ and $f=g$ in X. Object-oriented shell for *nix Basically on my site I have a bunch of song lyrics and in a static page I want to show them listed by album  and album position of the song and I have two custom fields with that data, sd_album_title and `sd_album_track_n. Plus some of the songs don't have an album yet, so both values are void, and I wish to list those ones at the foot of the others, sorted by alphabetical order.  The latest thing I tried at least to sort everything by the two field is this one:  $key = 'sd_album_title'; $themeta = get_post_meta($post-&gt;ID, $key, TRUE);  add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) {     if ($themeta != '') {         $query-&gt;set( 'post_type', 'lyric' );         $query-&gt;set( 'meta_key', 'sd_album_title' );         $query-&gt;set( 'orderby', 'meta_value' );         $query-&gt;set( 'order', 'ASC' );         $query-&gt;set( 'meta_query', array(               array(                     'key' =&gt; 'sd_album_title'               ),               array(                     'key' =&gt; 'sd_album_track_n',                     'value' =&gt; 'target_value',                     'compare' =&gt; '&gt;=',                     'type' =&gt; 'numeric'               )         ));     }     return $query; }  $getlist= 'my_get_posts'; $posts = get_posts( $getlist );   And my intention was to put an else at the end of it with an array ordered by title for the other songs, but it returns nothing as it is. Could something like this work with some corrections or am I on a totally wrong path? What are some ways to write object-oriented code in C? Especially with regard to polymorphism.    See also this Stack Overflow question . My ubuntu partition was deleted and I can't boot from either a DVD or USB What is the fate of the Asgardians at the start of Avengers: Infinity War? HashSet vs. List performance It's clear that a search performance of the generic HashSet&lt;T&gt; class is higher than of the generic List&lt;T&gt; class. Just compare the hash-based key with the linear approach in the List&lt;T&gt; class.  However calculating a hash key may itself take some CPU cycles, so for a small amount of items the linear search can be a real alternative to the HashSet&lt;T&gt;.  My question: where is the break-even?  To simplify the scenario (and to be fair) let's assume that the List&lt;T&gt; class uses the element's Equals() method to identify an item. I would like to change the caption in the List of Tables in a way it is different from the caption in the corresponding table. How can I do that? Does there exist a command to do that? If $f'$ is differentiable at $a$ then $f'$ is continuous at $(a-\delta,a+\delta)$ I'm trying to get the subcaptions and captions in sanserif font and Uppercased. According the manual of the caption package this should be possible in the following way.However, this doesnt seem to work. Am I defining something in the wrong way here?  \documentclass{article} \usepackage{floatrow} \usepackage[demo]{graphicx} \usepackage{subfig} \usepackage{caption} \floatsetup[figure]{subcapbesideposition = top}  \captionsetup{labelfont={sf,up}, labelsep=period, format = plain, singlelinecheck = false, textfont=rm, skip = 2pt} \captionsetup[subfloat]{labelfont = {up,sf},format = plain,textfont = rm,labelformat = simple, labelsep = period}  \begin{document}   \begin{figure}[h!]   \ffigbox[\textwidth]     {\begin{subfloatrow}         \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{A.pdf}}%         \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{B.pdf}}%       \end{subfloatrow}       \begin{subfloatrow}         \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{C.pdf}}%         \sidesubfloat[]{\includegraphics[width = 0.4\textwidth]{D.pdf}}%       \end{subfloatrow}}     {\caption{this is a caption}} \end{figure}  \end{document} How to use sed to replace only the first occurrence in a file? When is it appropriate to use a hyphen? What uses are there for "placement new"? Has anyone here ever used C++'s "placement new"? If so, what for? It looks to me like it would only be useful on memory-mapped hardware. Where should the comma be placed in the salutation of a letter? Sometimes I see a comma after the proper name:     Hello Mr. Black,      In order to give you....   But my native language is not English and I think that the comma in this phrase should be placed before the proper name:      Hello, Mr. Black.      In order to give you....   What is the correct punctuation in English? Can I use javascript to dynamically change a video's source? Outline radius?