Reply to Re: MySQL Problem

Your name:

Reply:


Posted by Stefan Rybacki on 10/30/05 15:02

Oli Filth wrote:
> Zsolt Munoz said the following on 30/10/2005 02:11:
>
>> I am pretty new to OOP w/PHP but I feel that it may be in my best
>> interest to learn it. I have created a class to connect to a MySQL DB
>> but when I go to run a query I only get the 1st row from table and
>> cannot get anything else. Below is the class I created and how I am
>> executing the program. Maybe someone could give me a hand with this.
>>
> <...snip code...>
>
> From a quick perusal of your code, it appears that you're opening and
> closing the MySQL connection on every function call...
>

Yes this is one point, but what he also is doing is
calling $db->result(), $db->result calles $db->query() and returns the first row. The next
time you call $db->result() you do the query again and again and again.

Rethink your class.
- only connect once (maybe in the constructor or the when the first query should be
executed -> save the connection for later use and check for its existence


Regards
Stefan

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация