php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #34352 mysqli_connect erroneous example 2
Submitted: 2005-09-02 21:32 UTC Modified: 2005-09-03 10:00 UTC
From: sr at brightlight dot ch Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: *
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: sr at brightlight dot ch
New email:
PHP Version: OS:

 

 [2005-09-02 21:32 UTC] sr at brightlight dot ch
Description:
------------
Quote from http://php.benscom.com/manual/en/function.mysqli-
connect.php:

Example 2. Procedural style

<?php
$link = mysqli_connect("localhost", "my_user", 
"my_password", "world");

/* check connection */ 
if (!$link) {
   printf("Connect failed: %s\n", mysqli_connect_error());
   exit();
}
...
?>
This leads to the wrong assumption mysqli_connect would 
return a link resource which it doesnt.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-03 05:00 UTC] sr at brightlight dot ch
I'd also like to point out that in the mysqli documentation 
there is a lot of talk about using procedural style with a 
link-resource. There is no way to actually retrieve the link-
resource. At least none is given in the manual. There is no 
property, mysqli_connect doesnt return one and there is no 
documented method for it.
 [2005-09-03 05:17 UTC] sr at brightlight dot ch
More careful reading would have helped. I was too used with 
the result beeing of type resource and not object (which didnt 
make sense to me just for a link).
Sorry for the inconvenience.
 [2005-09-03 10:00 UTC] vrana@php.net
Thus not a bug.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 15:01:33 2025 UTC