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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
39 - 25 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Sun Sep 20 18:01:26 2020 UTC