php-general Digest 24 Oct 2011 01:12:43 -0000 Issue 7534
Topics (messages 315396 through 315397):
Re: fetchOne vs. fetchAll vs. Sql's limit
315396 by: Stuart Dallas
Re: Friday Distraction
315397 by: tamouse mailing lists
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On 23 Oct 2011, at 06:52, AmirBehzad Eslami wrote:
> Dear list,
> As you already know, there are different ways to retrieve a record-set
> from a database. For example, here's the classic way to perform this in PHP:
>
> while ($row = mysql_fetch_assoc($db)) {
> // my row is available here
> }
>
> Speacking about PHP internals, what exactly happens here?
> 1) The PHP asks the Database-Layer to give a record in each while pass?
> I mean the record-set is not available in PHP's memory, but in MySQL's Mem.
>
> 2) Or the database-layer has gave the whole result-set to PHP, and we're
> just fetching a single row from PHP's memory?
It depends what function was used to do the query...
mysql_query will fetch all result rows from MySQL into a buffer.
mysql_unbuffered_query does not.
Read the documentation for mysql_unbuffered_query carefully before you start
using it: http://php.net/mysql_unbuffered_query
> 3) Finally, what is the efficient way to retrieve thousands or records which
> need to be processed at once? Using LIMIT?
Yes, use mysql_buffered_query, or mysql_query with limit to work through the
results in a paginated fashion.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
On Fri, Oct 21, 2011 at 12:38 PM, Tedd Sperling <tedd.sperl...@gmail.com> wrote:
> On Oct 21, 2011, at 12:27 PM, Daniel Brown wrote:
>
>> I'll get this week's Friday distraction kicked off here with
>> something shared with me by a Facebook friend. If you're on Facebook,
>> try this. It's pretty sweet (and safe for work and kids).
>>
>> http://www.takethislollipop.com/
>>
>> --
>> </Daniel P. Brown>
>
> Not meaning to be ignorant, but why?
>
> What's the point here?
>
> I have grandkids and about a dozen other species of relatives/friends trying
> to get me to do stuff (i.e., like/friend/post/reply/accept) on FaceBook et
> al, but I don't see the point. It looks like a total waste of time. Why
> should I care if someone post something on their FaceBook account? I would
> rather spend my time programming, teaching programming, and reading about
> programming.
>
> Maybe I'm just getting too old for this stuff.
The *point* is to have a common area for communicating with various
people. It's not like any of these services force you to listen to
people you don't want to hear from. You get to pick who to listen to.
If someone keeps sending you what they had for lunch, you can easily
drop them. The plus side of FB for me is that's where my kids and
family and friends hang out. That's why I'm there. As far as silly
distractions like the above, well, those come in all shapes and sizes
no matter where you go in life. It's like saying "I'm not going to use
the library because they play silly games during kids time." The modus
of talking about ourselves has changed from one-to-one to
many-to-many, largely because of the web and it's ability to link
people in many ways. It is most definitely less personal, you don't
have crafted communication from one person to another very much any
more.
It's definitely not for everyone. Some people can't deal with crowds
(either online or offline) and so will still opt for the crafted
one-to-one correspondence. But from personal experience I know that
more and more people are going to many-to-many route and to simply
ignore it and "not get it" seems like a missed chance at learning
something new.
--- End Message ---