mysqlorange-pi

Mysql returns NULL instead of a value


I had a local server (apache, php, mysql) running on my computer and everything was just fine. But I decided to migrate it on an orangePi. Now I have the problem, that when I write something in my database, then everything works, but when I try to read it using this code:

foreach ($db->query("SELECT * FROM " . $table ) as $row)
        $val[$val_len++] = $row;

I get the correct number of rows, but all the values are NULL. Help me please, I have no idea what's going on


Solution

  • just debug if the php query("SELECT * FROM " . $table ) as $row can return the value, if not check the datasource whether it is the expected db host and database or not