MySQL query won't execute - Class-> Function-> Form

I have built a query ( $query_q = "SELECT * FROM `table`;"

) and am trying to execute it inside a function.

public function read_from_table() {
    $query_q = "SELECT * FROM `table`";
    $query_a = mysql_query($query_q);
    while (mysql_fetch_array($query_a)) {
        echo "Did it!";
        //OR AS TRIED ANOTHER WAY
        return "Did it!";
    }
} 

      

And called as such:

echo $classInstance->read_from_table();
//OR AS TRIED ANOTHER WAY
$classInstance->read_from_table();

      

Both the ways the functions and the class were executed have been tried in every conceivable way, and yet I still don't get the result.
I am getting an error stating that the execution time has exceeded 30 seconds, so I added ini_set('max_execution_time', 0);

(knowing that this would eliminate the time limit altogether) to see if the query would run at all, it now runs for 30 minutes with no signs of life ... Why is the request not being executed?

Additional comments:

  • I am aware that I am using the amortized mysql_ * functions, this is at the request of the client and will be updated after the site is live and completed to the point where I am willing to change the whole thing to mysqli-> * functions.
  • The table I am calling (this name has been removed and replaced with `table`

    ) has only 9 rows in it, so it shouldn't have a big impact on the runtime (or will it?).
  • I had to remove all sensitive information from the function in order to satisfy the client and my employer. Please note that I cannot disclose information that the client and my employer do not want to disclose.
+3


source to share


2 answers


The problem was the internet and server went down.

Since then it has been sorted and works.



Thanks for your help and support with this.

DigitalMediaMan

+1


source


try it

error_reporting(E_ALL);

      



if everything is ok, try running this query from console, see how many times the query will run

before that, kill the old process in the database (show processlist and kill pid)

0


source







All Articles