FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » database access
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: database access [message #174200 is a reply to message #174198] Thu, 26 May 2011 14:30 Go to previous messageGo to previous message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma:
Senior Member
On 5/26/2011 9:37 AM, Jivanmukta wrote:
>> Do you really need to use PDO ?
>> Whats wrong with the regular PHP mysql_XXXX() functions ?
>
> I could not solve some problem with mysqli and this problem did not
> occur using PDO. Nobody could help me with this problem on newsgroups.
> If I remember correctly fetching some nonempty query returned false in
> mysqli, in PDO the same query returned proper set.

If the query is non-empty, you should have no problem in fetching the
results with the standard mysql functions. Why were you even bothering
with mysqli? Look for mysql_query, mysql_fetch_assoc, and
mysql_fetch_array in www.php.net. They are all you need.

What I regularly use most is:

$theArray = array();
$result = mysql_query("The query text");
if (FALSE !== $result) {
while ($row = mysql_fetch_assoc($result) {
$theArray[] = $row;
}
}

if (count($theArray)) {
.....
}


You could even put the query into your database class as a
getArray($query) method.

--
Shelly
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: a more elegant way?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 00:17:00 GMT 2024

Total time taken to generate the page: 0.04864 seconds