0

RUN SQL QUERIES VIA PHP DATA OBJECT

Hi guys I am wondering how can I run SQL queries via a PHP file using POD ? I used conn->query(""); but it did not work is there any way to connect to a database and run queries directly to it using PHP ? beside mysqli

23rd Jun 2018, 4:26 PM
Jalal Dev
2 Antworten
+ 4
Make sure your connection looks like this $db = new PDO("mysql:host=127.0.0.1;dbname=name", "root", ""); $query = $db->query("SELECT * FROM dbname") while($row = $query->fetch()) { } https://www.w3schools.com/php/php_mysql_prepared_statements.asp
23rd Jun 2018, 4:50 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
my host is "localhost" but online do I have to change it into 127.... ?
23rd Jun 2018, 4:52 PM
Jalal Dev