Re: MySQL Problem
- From: Stefan Rybacki <stefan.rybacki@xxxxxxx>
- Date: Sun, 30 Oct 2005 14:02:18 +0100
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 .
- References:
- MySQL Problem
- From: Zsolt Munoz
- Re: MySQL Problem
- From: Oli Filth
- MySQL Problem
- Prev by Date: Re: sytax error, but where?
- Next by Date: Re: html to plain text
- Previous by thread: Re: MySQL Problem
- Next by thread: Re: html to plain text
- Index(es):
Relevant Pages
|