I am not familiar with Linux/ Unix and I encountered a corruption.
How do I repair this?
Warning: mysql_num_rows():supplied argument is not a valid MySQL result resource in usr/local/apache2/htdocs/vicidial/AST_timeonVDADall.php

Dani AI

Generated

The PHP warning shown in ’s post ("mysql_num_rows(): supplied argument is not a valid MySQL result resource") is a symptom, not a definitive diagnosis. It usually means the preceding mysql_query() returned false (query error, broken connection, permission problem), so the script tried to call mysql_num_rows() on an invalid value. is correct that this should be handled in the PHP code; ’s repair suggestion applies only if a table integrity check proves corruption, and ’s recommendation to use third‑party tools should be treated with caution.

Quick, practical checklist (safe order):

  • Verify the PHP query result before calling mysql_num_rows() and log the MySQL error. Example pattern:

    $result = mysql_query($sql);
    if ($result === false) {
        error_log('MySQL error: ' . mysql_error());
        // handle or abort
    } else {
        $count = mysql_num_rows($result);
    }
  • Confirm database connection parameters (host/socket, user, password) used by the vicidial script and check the MySQL server is running.

  • Check table status and engine from the shell:

    mysql -u root -p -e "SELECT TABLE_NAME, ENGINE FROM information_schema.tables
    WHERE table_schema='your_db' AND table_name='your_table';"
    
    mysql -u root -p -e "CHECK TABLE your_db.your_table;"
  • If engine = MyISAM, use mysqlcheck or myisamchk (stop the server or ensure table is not being written to). If engine = InnoDB, do not use MyISAM repair tools — instead consider InnoDB recovery steps (see below).

InnoDB recovery outline (use only after full backups):

# stop server, add to my.cnf
[mysqld]
innodb_force_recovery=1

# start, dump the affected DB
mysqldump -u root -p your_db > /tmp/your_db.sql
# remove innodb_force_recovery and restore from dump on a clean server

Cautions and final notes: always take a filesystem-level backup or mysqldump before attempting repairs; inspect the MySQL error log (/var/log/mysql/ or /var/log/mysqld.log), verify disk space and file permissions, and avoid unknown commercial repair utilities unless vendor reputation is verified. For long‑term stability, migrate legacy mysql_* code to mysqli or PDO so query failures can be handled more robustly.

Recommended Answers

All 3 Replies

Try repair command to repair your database
mysql> repair table tablename;

If you fail to repair your database with above command than you need third party mysql repair tool to repair your database.

I am not familiar with Linux/ Unix and I encountered a corruption.
How do I repair this?
Warning: mysql_num_rows():supplied argument is not a valid MySQL result resource in usr/local/apache2/htdocs/vicidial/AST_timeonVDADall.php

That is error in PHP script.
If you are a dev. fix it or else seek for help to right people

I am not familiar with Linux/ Unix and I encountered a corruption.
How do I repair this?
Warning: mysql_num_rows():supplied argument is not a valid MySQL result resource in usr/local/apache2/htdocs/vicidial/AST_timeonVDADall.php

Just use any software and resolve the issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.