Morphing from mysql to mysqli

QUOWmelmmer

New Member
I am a little perplexed by the mysqli interface in PHP. When I set out yesterday to change my old mysql code to mysqli, the docs steered me down the road of \[code\]::prepare\[/code\], \[code\]::bind_params\[/code\] and \[code\]::execute\[/code\]. In my efforts to deal with the results, I ended up writing my own fetch_assoc - and had problems which I discussed on SO. One commentator queried what I was doing not using \[code\]::fetch_assoc\[/code\]. I had not even noticed the mysqli_result class. When I morphed my mysqli code from \[code\]::preapre\[/code\] to \[code\]::query\[/code\], the result handling became MUCH easier - with one exception: when previously I used \[code\]::bind_results\[/code\] to extract the columns, the PHP associative array that resulted would carry the correct data types; when instead I now use \[code\]::fetch_assoc\[/code\] etc, all I get is an array of strings. I am coding up a converter now. I just thought that since I already committed one cardinal error in my understanding of the mysqli library, I better post here to see whether there's an "official" way of getting type-congruent associative result arrays.Thanks.
 
Back
Top