Skip to content
Advertisement

Prepared statement mysqli SELECT * FROM users

Can someone please tell me what I’m doing wrong. I am trying to select everything from users and then I want to use the [‘password’] and den [‘verified’] strings from the database, where it says ‘//use your bound variables here’. I’m new to prepared statements trying to learn. Thanks

JavaScript

Advertisement

Answer

If you are only starting to learn PHP then you should learn PDO instead of mysqli. PDO is much easier and more suitable for beginners. Start here https://phpdelusions.net/pdo & https://websitebeaver.com/php-pdo-prepared-statements-to-prevent-sql-injection Don’t waste your time with mysqli.

Using PDO:

JavaScript

Using mysqli:

If you must use mysqli then you can use get_result() to fetch mysqli_result object from which you can then fetch an array or an object representing your data.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement