title: PHP return Database row details by user id
body: <p>I have my own cms that built ,</p>
  
  <p>I used on the userid AUTO_INCREMENT
  My db users look like this till now:</p>
  
  <pre><code>    userid | username | fname | email | password | salt | timastamp
     ----------------------------------------------------------------
        1       test      b.k   a@a.com  dsfsd...  df...    11334544
        2       test1     s.k   a@a.com  dsfsd...  df...    11334544
  </code></pre>
  
  <p>Here i removed the AUTO_INCREMENT and change the userid row from int to varchar
  And now i have  this :</p>
  
  <pre><code>    userid | username | fname | email | password | salt | timastamp
     ----------------------------------------------------------------
      4CsdGf     test      b.k   a@a.com  dsfsd...  df...    11334544
      5C6dd3     test1     s.k   a@a.com  dsfsd...  df...    11334544
  </code></pre>
  
  <p>I have removed from the userid Structure the AUTO_INCREMENT and using the following script to gerenate new id for every new register account:</p>
  
  <pre><code>function genID()
  {
  $seed = str_split('abcdefghijklmnopqrstuvwxyz' 
  .'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 
  .'0123456789' ); // and any other characters
  shuffle($seed); // probably optional since array_is randomized; this may be redundant
  $rand = '' ;
  foreach (array_rand($seed, 5) as $k) $rand .= $seed[$k];
  
  return $rand;
  
  }
  </code></pre>
  
  <p>Till now i used this function to get all user data by userid:</p>
  
  <pre><code> function get_user_data_by_userid($one_page_id)
  {
      $one_page_id = $this-&gt;db_clean($one_page_id);
  
      $query = "SELECT * FROM users WHERE userid = ".$one_page_id;
  
      //die($query);
      mysql_query("SET NAMES 'utf8'");
  
      $result = mysql_query($query, $this-&gt;connection);
  
      if(!$result) //ERROR IN YOUR SQL QUERY
      return false;
  
      if(mysql_num_rows($result)==0) //NO ROWS IN TABLE pages
      return false;
  
      $row = mysql_fetch_array($result, MYSQL_ASSOC);
  
      return $row;
  }
  
   $user_data = $func-&gt;get_user_data_by_userid($user_id);
  
   //example of take specific data :
  
    echo $user_data['userid'];
  </code></pre>
  
  <p>But its wont working anymore , its not get the data by the userid since i have change the user id from AUTO_INCREMENT to my own Generate ID'S function , Any idea what wrong ?</p>
  
  <p>I have did die to query at $func->get_user_data_by_userid() and its working perfect :</p>
  
  <pre><code>SELECT * FROM users WHERE userid = 63FWo
  </code></pre>
  
  <p>but its not retrive the data from that id why any idea?
  Thanks allot.</p>
  
  <p><strong>UPDATE:</strong>
  The fix :\ :</p>
  
  <pre><code> $query = "SELECT * FROM users WHERE userid = '$one_page_id'";
  </code></pre>
  
  <p>forgot quotes..</p>