I'm trying to use the foreign key but I can not. This SQL statement will create a table named tbl_estado
with 4 columns id, nome, uf, pais
and in column pais
will enter the foreign key that will be searched in tbl_pais
id
of the country that is the id
column.
$ where = axitech20
(bank)
$ tablep = tbl_pais
$ tablee = tbl_estado
$sql8="CREATE TABLE IF NOT EXISTS $aonde.$tablee (
id INT(6) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT PRIMARY KEY,
nome VARCHAR(75) DEFAULT NULL,
uf VARCHAR(5) DEFAULT NULL,
pais INT(6) DEFAULT NULL KEY '??????????' ($tablep)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=28";
I can not make the relationship that is something there in the ?????????? of the statement. Can you help me hit foreign key
?