php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79581 see the desc and test script
Submitted: 2020-05-10 19:14 UTC Modified: 2020-05-10 21:56 UTC
From: aguest1618 at protonmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: doesn't matter
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aguest1618 at protonmail dot com
New email:
PHP Version: OS:

 

 [2020-05-10 19:14 UTC] aguest1618 at protonmail dot com
Description:
------------
---
From manual page: https://php.net/mysqli.quickstart.dual-interface
---
Example #1 Easy migration from the old mysql extension
<?php
$mysqli = mysqli_connect("example.com", "user", "password", "database");
$res = mysqli_query($mysqli, "SELECT 'Please, do not use ' AS _msg FROM DUAL");
$row = mysqli_fetch_assoc($res);
echo $row['_msg'];

$mysql = mysql_connect("example.com", "user", "password");
mysql_select_db("test");
$res = mysql_query("SELECT 'the mysql extension for new developments.' AS _msg FROM DUAL", $mysql);
$row = mysql_fetch_assoc($res);
echo $row['_msg'];
?>


Test script:
---------------
In Example #1, are the msgs reversed ?

Shouldn't " ... Please do not use ... " be with mysql_connect - the deprecated ver ?

and " ...'the mysqli extension for new developments..." be with mysqli_connect -
the newer recommended ver ?



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-10 21:56 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2020-05-10 21:56 UTC] requinix@php.net
Read the code more closely. The first half uses mysqli to SELECT the message
  Please, do not use
and outputs it.

Then the second half uses mysql to SELECT the message
  the mysql extension for new developments.
and also outputs it.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 30 22:01:34 2025 UTC