CodeIgniter Forums
Updating a unique field in database (example: account username or email) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Updating a unique field in database (example: account username or email) (/showthread.php?tid=25401)

Pages: 1 2


Updating a unique field in database (example: account username or email) - El Forum - 12-11-2009

[eluser]sophistry[/eluser]
um, i dont' think that would work...

try just getting the result into a variable and using it in the query.
Code:
$id = $CI->input->post('fieldname');
$query = $CI->db->query("SELECT COUNT(*) dupe FROM $table WHERE $column = ‘$str’ AND id != '$id'");



Updating a unique field in database (example: account username or email) - El Forum - 12-12-2009

[eluser]Salvatore Formisano[/eluser]
Great, that worked out perfectly.

Many thanks mate,

Salvatore