php beginner safe input
<p>i need some help here.</p>

<p>I have this query:</p>

<pre><code>$order = isset($_GET['order']) ? mysql_real_escape_string($_GET['order']) : 'title';
$query = mysql_query("SELECT * FROM entry ORDER BY $order ASC");
</code></pre>

<p>You can either order by title, date or author.</p>

<p>But if someone gives $order something else it goes:</p>

<pre><code>Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\entries.php on line 20
</code></pre>

<p>How do I get rid of this error message?</p>

<p>Thanks</p>
