You are here: unique_key vs multiple_key « PHP SQL « IT news, forums, messages
unique_key vs multiple_key

Posted by KDCinfo on 05/08/06 18:12

Hi there,

Was wondering if someone knew why, when a MySQL field is marked as
Unique in phpMyAdmin, it shows up as a multiple_key in my application?

If I need to post more code, or the table structure, please just let me
know. I need to identify if a field is Unique, but don't feel I can
assume that a multiple_key means it is so.

Thanks.

Keith D Commiskey
http://kdcinfo.com | http://giftsforyou.biz

$getDataQueryQ = mysql_query("SELECT * FROM ".$tablename) or
die("Select Query failed: ".mysql_error());
$getDataQueryT1 = "";
$getDataQueryT2 = "";
while ($row=mysql_fetch_array($getDataQueryQ))
{ $icnt=0;
while ($icnt < mysql_num_fields($getDataQueryQ))
{ if ((strpos(mysql_field_flags($getDataQueryQ, $icnt),
"auto_increment")===false)) // Not a primary field
{ $flagIt = mysql_fetch_field($getDataQueryQ, $icnt);
if (!$flagIt)
{ echo "No information available<br />\n"; }
else { echo "Field " . $icnt . " : ";
echo $flagIt->name . " / P:";
echo $flagIt->primary_key . " / U:";
echo $flagIt->unique_key . " / M:";
echo $flagIt->multiple_key . " / Max:";
echo $flagIt->max_length . "<br>";
}
$getDataQueryT1 .= mysql_field_name($getDataQueryQ,
$icnt).", ";
$getDataQueryT2 .= $row[$icnt]."', '";
}
else
{ echo "Field " . $icnt . " : ";
print("<strong>Primary:</strong>
".mysql_field_name($getDataQueryQ, $icnt)."<br>");
}
$icnt++;
} }

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация