note 126867 added to mysqli.init
| From: | evgen at sysmasters dot net | Date: | Mon, 21 Feb 2022 20:41:03 +0000 |
| Subject: | note 126867 added to mysqli.init | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217636@lists.php.net to get a copy of this message | ||
Correct way to connect db
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("127.0.0.1", "db_user", "db_pass",
"db_name",3306);
$result = $mysqli->query("SELECT somefield1, somefield2 FROM sometable ORDER BY ID LIMIT
3");
/* Close the connection as soon as it becomes unnecessary */
$mysqli->close();
foreach ($result as $row) {
/* Processing data received from the database */
echo var_dump ($row);
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 188.163.4.94)
----
Manual Page -- https://php.net/manual/en/mysqli.init.php
Edit -- https://main.php.net/note/edit/126867
Del: integrated -- https://main.php.net/note/delete/126867/integrated
Del: useless -- https://main.php.net/note/delete/126867/useless
Del: bad code -- https://main.php.net/note/delete/126867/bad+code
Del: spam -- https://main.php.net/note/delete/126867/spam
Del: non-english -- https://main.php.net/note/delete/126867/non-english
Del: in docs -- https://main.php.net/note/delete/126867/in+docs
Del: other reasons-- https://main.php.net/note/delete/126867
Reject -- https://main.php.net/note/reject/126867
Search -- https://main.php.net/manage/user-notes.php