An error has ocurried Unknown field :picture

  1. 14 years ago

    After configuring the visual phonebook in the paragraph : Configuring Visual phonebook,the error continued.

    ((((my MYSQL root password is 'root')))

    [root@centos init.d]# service mysqld start
    Iniciando MySQL: [ OK ]

    [root@centos fop2]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 5
    Server version: 5.0.77 Source distribution

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | fop2 |
    | mysql |
    | test |
    +--------------------+
    4 rows in set (0.01 sec)

    mysql> use fop2
    Database changed

    mysql> show tables;
    Empty set (0.00 sec)

    [root@centos fop2]# mysql -u root -proot < mysql.db

    mysql> GRANT ALL on fop2.* TO fop2@localhost IDENTIFIED BY 'root';
    Query OK, 0 rows affected (0.00 sec)

    mysql> exit
    Bye.

    [root@centos fop2]# service fop2 restart
    Shutting dows Flash Operator Panel 2: [ OK ]
    Starting Flash Operator Panel 2: [ OK ]

    --------------------------------------
    config.php

    <?
    // Database connection details
    $DBHOST = 'localhost';
    $DBNAME = 'fop2';
    $DBUSER = 'fop2';
    $DBPASS = 'root';

    $language="en";

    ---------------------------------------

    ----------------------------------------

  2. Log-in to mysql and then

    use fop2;
    select * from visual_phonebook;

    do you see the picture column?

    also goto

    /var/www/html/fop2/

    edit config.php

    Change

    define('DEBUG',false);

    to

    define('DEBUG',true);

    save and upload, goto http://YOUR_SERVER_IP/fop2/phonebook.php
    and paste the output here

  3. 1)

    mysql> use fop2;
    Database changed
    mysql> select * from visual_phonebook;
    ERROR 1146 (42S02):Table 'fop2.visual_phonebook' doesn´t exist

    2)edit config.php

    notice
    /var/www/html/fop2/lib/dblib.php (line 233)

    mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
    notice
    /var/www/html/fop2/lib/dblib.php (line 233)

    mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource

    An error has occurred

    Unknown field: picture
    notice
    /var/www/html/fop2/lib/dblib.php (line 344)

    mysql_num_fields(): supplied argument is not a valid MySQL result resource
    notice
    /var/www/html/fop2/lib/dblib.php (line 333)

    mysql_num_rows(): supplied argument is not a valid MySQL result resource

    No records found
    notice
    /var/www/html/fop2/lib/dblib.php (line 244)

    mysql_fetch_row(): supplied argument is not a valid MySQL result resource

  4. Hows about

    mysql -u root -proot
    use fop2;

    copy all and paste to console screen

    CREATE TABLE `visual_phonebook` (
      `id` int(11) NOT NULL auto_increment,
      `firstname` varchar(50) default NULL,
      `lastname` varchar(50) default NULL,
      `company` varchar(100) default NULL,
      `phone1` varchar(25) default NULL,
      `phone2` varchar(25) default NULL,
      `picture` varchar(100) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM;

    and then

    show columns from visual_phonebook;
    +-----------+--------------+------+-----+---------+----------------+
    | Field     | Type         | Null | Key | Default | Extra          |
    +-----------+--------------+------+-----+---------+----------------+
    | id        | int(11)      | NO   | PRI | NULL    | auto_increment |
    | firstname | varchar(50)  | YES  |     | NULL    |                |
    | lastname  | varchar(50)  | YES  |     | NULL    |                |
    | company   | varchar(100) | YES  |     | NULL    |                |
    | phone1    | varchar(25)  | YES  |     | NULL    |                |
    | phone2    | varchar(25)  | YES  |     | NULL    |                |
    | picture   | varchar(100) | YES  |     | NULL    |                |
    +-----------+--------------+------+-----+---------+----------------+
    7 rows in set (0.00 sec)

    for testing

    insert into visual_phonebook(firstname, lastname, phone1) values('john', 'doe', '0141123456');
    select * from visual_phonebook;
    +----+-----------+----------+---------+------------+--------+---------+
    | id | firstname | lastname | company | phone1     | phone2 | picture |
    +----+-----------+----------+---------+------------+--------+---------+
    |  1 | john      | doe      | NULL    | 0141123456 | NULL   | NULL    |
    +----+-----------+----------+---------+------------+--------+---------+
    1 row in set (0.00 sec)
    
  5. Ok Thanks!!!

    But not everything is correct.
    This error has not been solved.

    notice
    /var/www/html/fop2/lib/dblib.php (line 233)

    mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource

    -----------------------------------------------------------
    dblib.php

    /**

    • Fetch results by associative array
    • * @param mixed $query Select query or database result
    • @return array Row
    • /

    public function fetch_assoc($query = false) {
    $this->res_type($query);
    return mysql_fetch_assoc($query); <<<<<<<<----------LINE 233
    }
    ------------------------------------------------------------

  6. I suppose you could do something like

    public function fetch_assoc($query = false) {
            $this->res_type($query);
    	 if($query and !is_bool($query)) { 
      		return mysql_fetch_assoc($query); 
    	 } 
     }

    But my PHP isn't very good so if Nicolas could confirm that this isn't going to bork anything :D

  7. OKKKKKK !!!!! tHANKS tHOMAS.Error solved.

or Sign Up to reply!