Use the following in a php script to check weather or not the account number is already in the database
if (sql_num_rows(sql_query("select ACCOUNTNUMBER from DATEBASETABLE where ACCOUNTNUMBER='$ACCOUNTNUMBER'", $dbi), $dbi) > 0) $stop = "ERROR: ACCOUNT NUMBER ALREADY USED";
> Will Hanke wrote:
> I have a two-parter that maybe someone can help me with...
>
>Situation:
>I have a client who wants to input new customers into his database. I've written a PHP form which allows him to do so.
>In the account number field, he can either type in the number, or have it auto-assigned.
>
>Problem:
>When the client adds the info to the form and hits Submit...
>
>1. How can I pull the list of account numbers, and verify that the one he entered is not already assigned?
>
>2. How can I assign a 6-digit account number if he chooses auto-assign without duplicating an existing acct. number?
>
>will
> Private Reply to Kevin Fry (new win) |