PHP Classes

MYSQLI-resulttype

Recommend this page to a friend!

      PHP MySQL to MySQLi  >  PHP MySQL to MySQLi package blog  >  How to Convert MySQL ...  >  All threads  >  MYSQLI-resulttype  >  (Un) Subscribe thread alerts  
Subject:MYSQLI-resulttype
Summary:Use mysqli's $resulttype in mysqli_fetch_array
Messages:3
Author:Christian Wassmer
Date:2018-10-12 12:17:14
 

  1. MYSQLI-resulttype   Reply   Report abuse  
Picture of Christian Wassmer Christian Wassmer - 2018-10-12 12:17:14
I think you forgot to mention to use the mysqli constants for $resulttype n mysqli_fetch_array

MYSQLI_BOTH
MYSQLI_ASSOC
MYSQLI_NUM

  2. Re: MYSQLI-resulttype - constants   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2018-10-12 14:44:23 - In reply to message 1 from Christian Wassmer
They where added to the package after the article was published. For anyone not using the package, you may need to add the following, if your code uses constants, where your connection to the database is being made.

//predifined fetch constants
define('MYSQL_BOTH',MYSQLI_BOTH);
define('MYSQL_NUM',MYSQLI_NUM);
define('MYSQL_ASSOC',MYSQLI_ASSOC);

Dave

  3. Re: MYSQLI-resulttype   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2018-10-12 14:48:10 - In reply to message 2 from Dave Smith
If converting, replace the old constant with the new one..

MYSQL_BOTH would be MYSQLI_BOTH
MYSQL_NUM would be MYSQLI_NUM
MYSQL_ASSOC would be MYSQLI_ASSOC

Dave