Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm thinking the typo is the answer, but I have to point out one deadly mistake you've made, and that is that you're piping user-supplied input directly into an SQL query. This opens your code to a slew of malicious attacks called <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">SQL injection</a> attacks. I'm not trying to be preachy, but it's <em>very</em> important that you read and understand that article, especially the part about Mitigation at the bottom.</p> <p>I would suggest you use something like this instead:</p> <pre><code>$query = 'SELECT first_name, last_name '. 'FROM formdata WHERE first_name LIKE ? OR last_name LIKE ?;'; $sth = mysqli_prepare($dbh, $query); mysqli_stmt_bind_param($sth, "s", '%'.$first_name.'%'); mysqli_stmt_bind_param($sth, "s", '%'.$last_name.'%'); $result = mysqli_execute($sth); </code></pre> <p>I know it's a bit longer and more complicated, but trust me, it will save you a <em>world</em> of headache. The sooner you learn about this and get it deeply ingrained in your psyche that you can never, ever, <em>ever</em> write a query that passes unsanitized input straight to the database, the happier we all will be (and the longer you will get to keep your job eventually. ;).</p> <p>Sorry if I'm coming on strong, but in my opinion, the single most important lesson you need to pick up early in developing database-driven web sites is that you really need to be proficient at spotting injection vulnerabilities to the point where it's automatic and when you see it, you think, "Ooh! Noooo! Don't do that!!!"</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload