misc. questions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

misc. questions

Post by s.dot »

I have a few simple questions I'd like to know the answer to, that aren't worthy of starting an individual topic, so I'll just ask them together.

1. mysql_fetch_assoc is faster than mysql_fetch_array because it selects less information, correct?

2. Is it possible to get a database integer and perform operations on it without running a query to select the integer, then running another query to update it? If so, how?

3. Does the loading speed of a page depend on the processor of the machine it's being hosted on.. the processor of the machine viewing it.. or both?

I had another one but I forget it at the moment. :(.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

1. mysql_fetch_assoc is faster than mysql_fetch_array because it selects less information, correct?
Is it really faster? Is is it significant? Meaby you could say that mysql_fetch_assoc consumes a little less memory, but i would never take that into consideration for changing my code. It's less expensive to buy some extra RAM.
2. Is it possible to get a database integer and perform operations on it without running a query to select the integer, then running another query to update it? If so, how?

Code: Select all

UPDATE table SET counter=2*counter+1;

Code: Select all

3. Does the loading speed of a page depend on the processor of the machine it's being hosted on.. the processor of the machine viewing it.. or both?
(a) time to request the page
(b) time to generate the page (also consider time to access the database etc..)
(c) time to fetch the page
(d) time to render the page

Imho bandwith has a great influence on (a) and (c), where cpu crunching will have great influence on (b) and (d)
Post Reply