Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ignoring for the moment all the other issues with this code and approach (SQL injection issues, GET vs. POST issue, etc.), and dealing with the update not changing things as expected, there are a couple of things to check.</p> <ul> <li><p>Try outputing the update query in your logs and make sure that it actually looks like what your expecting. It could be that the values you're meaning to push across the wire are not making it into the query or that.</p></li> <li><p>Verify that running the query by hand in an standalone SQL client (mysql, squirrel, etc...) Actually updates a record. It's entirely possible that a valid update query may not match any records. (Say the username value you're looking for does not match one that's in the database.</p></li> <li><p>Not knowing your infrastructure, I'd suggest some sanity checks: Are you actually pointing at the right database? Do you have a your update wrapped in a transaction that's rolling back? etc ...</p></li> </ul> <p>A few other tips:</p> <ul> <li><p>I would suggest looking at <a href="http://php.net/manual/en/book.pdo.php" rel="nofollow">PDO</a>, in particular how <a href="http://www.php.net/manual/en/pdo.prepared-statements.php" rel="nofollow">Prepared Statements</a> work. The kind of query you're building above is someone to run off with all your data or worse. While not a panacea, prepared statements are a solid first step.</p></li> <li><p>Take a look at <a href="http://api.jquery.com/category/ajax/" rel="nofollow">Jquery's Ajax</a> functions. In particular the <a href="http://api.jquery.com/jQuery.post/" rel="nofollow">post</a> method. It provides a simple interface for making ajax calls without having to construct special url strings. Plus, switching to a POST will avoid your data showing up in webserver logs files.</p></li> </ul>
 

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