CodeIgniter Forums
database query match - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: database query match (/showthread.php?tid=43183)



database query match - El Forum - 07-03-2011

[eluser]andes[/eluser]
hi,

i want to be able to take the data from my form, say name and last name and then be able to run a query to see if the name and last name are already in the database, if it is, then to display the data in the third column of this table, and if not, then to just enter it into the database

so in summary,

user enters form: name and last name
a function should search the database table column name and last name and see if there is a match,
if yes, then return data in the third column of this table
if not, then insert name and last name into database


can somebody help/guide me in the right direction here?

thanks in advance


database query match - El Forum - 07-03-2011

[eluser]web-johnny[/eluser]
[quote author="andes" date="1309742975"]hi,

i want to be able to take the data from my form, say name and last name and then be able to run a query to see if the name and last name are already in the database, if it is, then to display the data in the third column of this table, and if not, then to just enter it into the database

so in summary,

user enters form: name and last name
a function should search the database table column name and last name and see if there is a match,
if yes, then return data in the third column of this table
if not, then insert name and last name into database


can somebody help/guide me in the right direction here?

thanks in advance[/quote] You can use the active record of codeigniter you can see at http://ellislab.com/codeigniter/user-guide/database/active_record.html