Issue is with changes in wordpress. They have added $wpdb which will be used to access the mysql, instead of mysql_query.
I did the following steps to migrate:
find . -type f -exec sed -i 's/<?php/<?php global $wpdb;/g' {} +
find . -type f -exec sed -i 's/mysql_query("SELECT/$wpdb->get_results("SELECT/g' {} +
find . -type f -exec sed -i 's/mysql_query/$wpdb->query/g' {} +
find . -type f -exec sed -i 's/mysql_num_rows/$wpdb->num_rows;\/\//g' {} +
For mysql_fetch_array we need to take each function, change it using $wpdb->get_results and the use foreach instead of while.
Also, add a param ARRAY_A to $wpdb->get_results to create an array instead of object access notation.