MySQL操作程序四十四(mscs_header.pl)

返回
不需要增加nationid,可用area!!! mysql> ALTER TABLE owners DROP nationid; Query OK, 549 rows affected (4.33 sec) Records: 549 Duplicates: 0 Warnings: 0 mysql> show columns from owners; +----------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | company | char(100) | YES | | NULL | | | name1 | char(100) | YES | | NULL | | | address | char(100) | YES | | NULL | | | person | char(50) | YES | | NULL | | | telfax | char(100) | YES | | NULL | | | email | char(100) | YES | | NULL | | | homepage | char(100) | YES | | NULL | | | memo | char(100) | YES | | NULL | | | area | int(11) | YES | | 9 | | | ourref | text | YES | | NULL | | | ship | text | YES | | NULL | | | money | text | YES | | NULL | | +----------+-----------+------+-----+---------+----------------+ 13 rows in set (0.27 sec) 增加nationid(为消费税) mysql> ALTER TABLE owners ADD nationid INT DEFAULT 2; Query OK, 549 rows affected (0.47 sec) Records: 549 Duplicates: 0 Warnings: 0 mysql> show columns from owners; +----------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | company | char(100) | YES | | NULL | | | name1 | char(100) | YES | | NULL | | | address | char(100) | YES | | NULL | | | person | char(50) | YES | | NULL | | | telfax | char(100) | YES | | NULL | | | email | char(100) | YES | | NULL | | | homepage | char(100) | YES | | NULL | | | memo | char(100) | YES | | NULL | | | area | int(11) | YES | | 9 | | | ourref | text | YES | | NULL | | | ship | text | YES | | NULL | | | money | text | YES | | NULL | | | nationid | int(11) | YES | | 2 | | +----------+-----------+------+-----+---------+----------------+ 14 rows in set (0.00 sec)
mysql> show columns from owners; +----------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | company | char(100) | YES | | NULL | | | name1 | char(100) | YES | | NULL | | | address | char(100) | YES | | NULL | | | person | char(50) | YES | | NULL | | | telfax | char(100) | YES | | NULL | | | email | char(100) | YES | | NULL | | | homepage | char(100) | YES | | NULL | | | memo | char(100) | YES | | NULL | | | area | int(11) | YES | | 9 | | | ourref | text | YES | | NULL | | | ship | text | YES | | NULL | | | money | text | YES | | NULL | | +----------+-----------+------+-----+---------+----------------+ 13 rows in set (0.53 sec)
[error] [client 127.0.0.1] Use of uninitialized value in concatenation (.) or string at ./pro/mscs_header.pl line 36 36: $t{line1} .= '<br>' . $rec[2]; 分析: modes_header使用的table owners hull_no makers ==>修改如下 if ( $rec[2] ) { $t{line1} .= '<br>' . $rec[2]; } if ( $rec[3] ) { $t{line1} .= '<br>' . $rec[3]; } if ( $rec[4] ) { $t{line1} .= '<br>' . $rec[4]; } if ( $rec[5] ) { $t{line1} .= '<br>' . $rec[5]; }
mysql> show columns from owners; +----------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | company | char(100) | YES | | NULL | | | name1 | char(100) | YES | | NULL | | | address | char(100) | YES | | NULL | | | person | char(50) | YES | | NULL | | | telfax | char(100) | YES | | NULL | | | email | char(100) | YES | | NULL | | | homepage | char(100) | YES | | NULL | | | memo | char(100) | YES | | NULL | | +----------+-----------+------+-----+---------+----------------+ 9 rows in set (0.11 sec) mysql> show columns from hull_no; +---------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | HULL_NO | char(50) | YES | | NULL | | | name | char(50) | YES | | NULL | | | built | date | YES | | NULL | | | flag | char(50) | YES | | NULL | | | memo | char(100) | YES | | NULL | | +---------+-----------+------+-----+---------+----------------+ mysql> show columns from makers; +----------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | company | char(100) | YES | | NULL | | | name1 | char(100) | YES | | NULL | | | address | char(100) | YES | | NULL | | | person | char(50) | YES | | NULL | | | telfax | char(100) | YES | | NULL | | | email | char(100) | YES | | NULL | | | homepage | char(100) | YES | | NULL | | | memo | char(200) | YES | | NULL | | | nationid | int(11) | NO | | 2 | | +----------+-----------+------+-----+---------+----------------+ 10 rows in set (0.11 sec) $t{line1} = $rec[1]; $t{line1} .= '<br>' . $rec[2]; $t{line1} .= '<br>' . $rec[3]; $t{line1} .= '<br>' . $rec[4]; $t{line1} .= '<br>' . $rec[5]; #追加
返回