Hi all,

I'm working on a db entry script that generates a 6-character code, checks to see if that code is in the db already, and re-generates the code if it's found.

This is probably pretty simple, and I think I have a working solution but I'd like to have some other eyes look at it.

PHP Code:
//$code = strtoupper(genCode(6));
$code 'ABCDEF';
$query "SELECT clientcode ";
$query .= "FROM clients ";
$rows $dbh->query($query);
$rows as $row)
$code strtoupper(genCode(6));
As you can see, I hard coded a value into the $code var that I know is in the DB. Does this seem like the most efficient way, or am I missing out on a better way?

Thanks for any advice.