title: One Little Error...
body: <p>I'm writing a URL shortener... I have this one error that i just can't seem to get rid of. I feel its really obvious but I'm not seeing it. </p>
  
  <p>(I'm a noob ;)  ) Here's the Error:</p>
  
  <pre><code>'mysql_result(): supplied argument is not a valid MySQL result resource in &lt;b&gt;/home2/bythewa1/public_html/jbgc/func.inc.php&lt;/b&gt; on line &lt;b&gt;23'
  </code></pre>
  
  <p>And here's my code from that page.</p>
  
  <pre><code>&lt;?php
  include("db.inc.php");
  
  function is_min($url)
  {
  
  return(preg_match("/jbgc\.me/i", $url)) ? true : false; 
  
  }
  
  
  function gen_code()
  {
  $charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';    
  return substr(str_shuffle($charset), 0, 6);
  }
  
  
  
  function exists($code) {
  $code = mysql_real_escape_string($code);
  $code_exists = mysql_query("SELECT COUNT('url_id') FROM 'mini_shortener' WHERE                  'code'= '$code' LIMIT 1");
  return (mysql_result($code_exists, 0) == 1) ? true : false;
   }
  
  
  
  function shorten($url, $code){
  $url = mysql_real_escape_string($url);
  $code = mysql_real_escape_string($code);
  mysql_query("INSERT INTO 'mini_shortener' VALUES('', '$url', '$code')");
  return $code;
  
  
  }
  
  
  
  ?&gt;
  </code></pre>