+ 1

Where do i put Sql codes to query data in PHP?

20th Jul 2022, 4:43 PM
Khabir khalid
Khabir khalid - avatar
1 Answer
- 1
This question is very unspecific so I don't know if this will help you. Basically you need to create a new Mysqli Object with your DB Credentials and then you can call the query method with your SQL Statement. However using prepared Statements especially when using User Input is highly recommended. So you should use the prepare method with your query and placeholders, use the bind method to add the placeholders and then call execute toget the data. Here are some Examples: https://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php Be aware, that the mysqli extension for php must be installed and enabled. Also maybe you can post more information on your specific problem like: - what code do you already have - what sql query are you trying to run - error messages if you are getting any This might help others to give more specific answers to your problem.
21st Jul 2022, 5:18 PM
David Br
David Br - avatar