title: Check for 'string' in a MySQL column using PHP
body: <p>So basically I want to check a <code>MySQL database</code> table to see if a certain number or string is present in a certain column (using PHP).  </p>
  
  <p>The reason for this is that each “member” added to my table is given a unique, random, 9-digit number between 100000000 and 999999999.  However, I need to make sure that the PHP code doesn’t generate an ID that has already been given to some other member in the past.  If it finds that the generated ID already exists, it will re-generate the number until it gets one that has not been previously used.</p>
  
  <p>Now I’ve done some research and I’ve found questions similar to this, but none quite seem to answer this specific problem using PHP.  Some have said to use INSTR (see second solution: <a href="https://stackoverflow.com/questions/2602252/mysql-query-string-contains">MySQL query String contains</a>), but I’m not quite sure how I could implement that into what I’m trying to do (it returns all rows (supposedly) where ‘string’ occurs in a column, but that doesn’t help.  If it were how many times it occurs, then we would be on the right track).
  If this isn’t possible or very difficult to do, then I could also just read all the data in my specific column (see: <a href="https://stackoverflow.com/questions/5229501/how-get-all-values-in-a-column-using-php?newreg=7eaa0812d70848e38f37cc3d6ea233ae">How get all values in a column using PHP?</a>) and then perform a regular PHP function somehow to search for my generated ID…and if it returns false then we don’t have to re-generate.</p>
  
  <p>So the question is: How can I perform a function of sorts which returns true or false in regards as to whether or not ‘string’ (or number) is present in a certain MySQL table column (using PHP)?
  I’m also working with MySQLi, Procedural syntax…and I’m a relative beginner when it comes to MySQL and PHP.</p>
  
  <p>Thanks in advance!</p>