it's a foreign key?

#2
[eluser]xwero[/eluser]
if you name your fieldnames well it's easy to know if a field is foreign key or not.
Code:
is_foreign_key($fieldname)
{
   $tables = $this->db->list_tables();

   foreach ($tables as $table)
   {
      $length = strlen($table);
      if(strncasecmp($table,$fieldname,$length) == 0)
      {
          return TRUE;
      }
   }

   return FALSE;
}


Messages In This Thread
it's a foreign key? - by El Forum - 04-18-2008, 09:08 AM
it's a foreign key? - by El Forum - 04-18-2008, 09:16 AM
it's a foreign key? - by El Forum - 04-18-2008, 09:36 AM
it's a foreign key? - by El Forum - 04-20-2008, 06:30 AM
it's a foreign key? - by El Forum - 04-20-2008, 03:51 PM
it's a foreign key? - by El Forum - 04-20-2008, 03:52 PM
it's a foreign key? - by El Forum - 04-21-2008, 06:53 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.