18.3. Modifying the PHP-Nuke FAQ module

Figure 18-2. Administration panel: FAQ.

Administration panel: FAQ.

In this section we modify the PHP-Nuke FAQ module:

18.3.1. How to add more than 127 FAQ answers

You have 127 Q&A. You cannot add more, if you delete one, you can add one.

Cause: Looking at the sql/nuke.sql script that creates the PHP-Nuke tables on installation, we see the following for the structure of the nuke_faqAnswer table:

# 
# Table structure for table `nuke_faqAnswer`
# 
  
CREATE TABLE nuke_faqAnswer ( 
  id tinyint(4) NOT NULL auto_increment,
  id_cat tinyint(4) NOT NULL default '0',
  question varchar(255) default ",
  answer text,
  PRIMARY KEY  (id),
  KEY id (id), 
  KEY id_cat (id_cat)
) TYPE=MyISAM;

From the MySQL manual on column types, we see:

TINYINT[(M)] [UNSIGNED] [ZEROFILL]

A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255.

so that tinyint is a very small integer indeed in this case.

Solution: Change the length of id and id_cat of nuke_faqAnswer. You can do this with phpMyAdmin, or by logging into MySQL from the console and, after choosing the PHP-Nuke database ("use xxxx;"), by typing:

alter table nuke_faqAnswer modify id SMALLINT unsigned;
alter table nuke_faqAnswer modify id_cat SMALLINT unsigned;

See also FAQ problem.