sql - most efficent way to compare a form value and database value -


i have created single table in magento database, table has no connections of magento tables. have created form allows user put information table.

within table there column must hold unique value, have set column allow unique values in it.

what i'm doing passing data in without checking if value unique , getting 'integrity constraint violation' message shown on screen.

what want before trying pass data table check value user trying enter not exists within table , if does, pass them on relevant page, or possible use 'integrity constraint violation' pass user onto relevant page?

i know how compare values using raw php , mysql code, after reading on magento see using sql queries discouraged considered creating array hold rows column comparing array against users inputted data, seems big waste of resources database grows.

how best way achieve this?

if situation sql query acceptable run directly on table, in code find function need use?

in view, following can possible solutions:

  1. either use stored procedure in database check if value exists in table. if return message trapped , corresponding action performed in front end.
  2. use hashmap construct (map collection) cut processing time minimum in front end.

i hope helps.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -