|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
I'm not new to PHP, but i have never had reason to use classes before. I am starting a personal project and I decided a class file would be a usefull because at the very least I would get some expeience using them.
Almost everything that I have tried so far has worked until now. I have to query a mysql db on a regular basis. So I decided instead of having to write out eh whole thing everytime I would put it into a class. Now it creates the object however I am trying to put the object through a while loop with mysql_fetch_array() nothign happens. Please remember this is just some test code. If what I want can be done the final code may look a little (a lot) different PHP Code:
PHP Code:
__________________
CHornJr "One day I'll know what I am doing" ![]() My Blog Suanhacky Lodge #49 Rebel Squadrons |
|
#2
|
||||
|
||||
|
On your first block of code it says:
while($result2=mysql_fetch_array($result)) { But your echo statement relates to $result... Quote:
|
|
#3
|
||||
|
||||
|
Well that was an error. But that wasn't what was causing me my problem. I forogt to insert any information into the table so it couldn't run through the loop. That is fixed now.
Now my next problem with classes... I want to run the same code but as an object in the same class. However it tells me the function 'dbselectquery()' is undefined. So how can I get a function from within a class run another function from within the same class PHP Code:
PHP Code:
|
|
#4
|
||||
|
||||
|
dbSelectQuery() is declared within the same class?
try calling it using $this->dbSelectQuery() same goes for the class's instance variables... $this->variable Variables local to the method being called [obviously] don't need the be used this way... just instance variables |
|
#5
|
||||
|
||||
|
Quote:
It's working now. Thanks. Hopefully, but probably not, this will be my last post in this thread |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Newbie to classes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|