-3
$result_row= $conn->query("SELECT COUNT(*) FROM WHERE discordid = ". $_SESSION['user_id']."");
if(result_row){}

then I'm sent this error: Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in /data/index.php:194 Stack trace: #0 {main} thrown in /data/index.php on line 194

  • 2
    Between your `FROM` and `WHERE`, there is no table name defined. Might want to start there. – Guido Faecke May 17 '22 at 22:50
  • Questions that ask "please help me" tend to be looking for highly localized guidance, or in some cases, ongoing or private assistance, which is not suited to our Q&A format. It is also rather vague, and is better replaced with a more specific question. Please read [Why is "Can someone help me?" not an actual question?](//meta.stackoverflow.com/q/284236). – Dharman May 17 '22 at 22:56
  • **Warning:** You are wide open to [SQL Injections](https://php.net/manual/en/security.database.sql-injection.php) and should use parameterized **prepared statements** instead of manually building your queries. They are provided by [PDO](https://php.net/manual/pdo.prepared-statements.php) or by [MySQLi](https://php.net/manual/mysqli.quickstart.prepared-statements.php). Never trust any kind of input! Even when your queries are executed only by trusted users, [you are still in risk of corrupting your data](http://bobby-tables.com/). [Escaping is not enough!](https://stackoverflow.com/q/32391315) – Dharman May 17 '22 at 22:56

0 Answers0