PHP 8.5.0 Alpha 4 available for testing

Voting

: max(one, six)?
(Example: nine)

The Note You're Voting On

evgen at sysmasters dot net
3 years ago
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);
}

<< Back to user notes page

To Top