Uncaught Error: Call to undefined function mysql_fetch_array() in C:\xampp\htdocs\GDB\MPT.php:72 Stack trace: #0 {main} thrown in C:\xampp\htdocs\GDB\MPT.php on line 72
I have this error while trying to run this command
can you help me find out what is wrong?
in this case i get this
Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\xampp\htdocs\GDB\MPT.php:72 Stack trace: #0 C:\xampp\htdocs\GDB\MPT.php(72): mysqli_fetch_array(false) #1 {main} thrown in C:\xampp\htdocs\GDB\MPT.php on line 72
You’re vulnerable to SQL Injection attacks with that code. You should always use prepared statements when plugging any data into a query, no matter what the source of the data is or how well you trust the source of the data
Then it should be quoted.
There is a world of difference between GDB and “GDB”, as you said it doesn’t have a value so your query is trying to access a table without a name. If you captured errors you would probable get an error that the parameter is expecting a string not null.
The original query is enclosed with double quotes. Enclosing the table name with double quotes would produce a syntax error. Backticks should be used for quoting table names and columns.
Table references go in backticks. They also dont NEED to go in backticks (in MOST cases). The database engine will interpret whatever comes immediately after FROM as a table reference (unless it runs into a reserved word token, like SELECT, which is when backticks become mandatory, if for some reason you decided to use a reserved word as a table or database name).