|
Posted by "Satyam" on 10/21/13 11:16
Aren't we oversimplifying the issue assuming that the records inserted
cannot have everything duplicated but the autoincrement field?
If you are taking an order and the customer says 'hey, add another of this',
with the code below the system will reject it because it assumes that it is
a refresh and not a new addition to the order.
You are in the supermarket line and the teller is scaning your purchase for
the barcodes. You wouldn't be able to buy more than one of each! (I know
that you wouldn't use a browser in that environment, but for the purpose of
the database analysis, it just shows the point)
NO, some tables do have records which are basically duplicate of one another
except for the autoincrement field, and those cannot be checked this way.
And, besides, as mentioned elsewhere in this thread (myself included) there
are easier ways which do not even involve database access.
Satyam
"Marcus Joyce" <newsletters@online-obsession.com> wrote in message
news:428A7964.5000905@online-obsession.com...
> Why dont you check that data isnt being duplicated?
>
> $query = "SELECT auto_col FROM table where col1 = $var1 & col2 = $var
> 3.............";
> $call_query = mysql_query($query,.......
> $query_data = mysql_assoc($call_query);
>
> if(!$query_data) { do form }
>
> else echo "information already exists in database";
>
>
> Pierce
>
> Robert Meyer wrote:
>
>>Hello,
>>
>>Scenario:
>>1) User is presented a blank form.
>>2) User fills in form.
>>3) User submits form.
>>4) Record is added to database.
>>5) Back to 1).
>>All is fine to here.
>>6) User clicks refresh.
>>7) Another record is added, same data except auto-increment field.
>>How do I prevent these last two steps, or at least prevent a record
>>from being added when refresh is clicked?
>>
>>Regards,
>>
>>Robert
>>
[Back to original message]
|