|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||||||
|
||||||||
|
need PEAR DB help
Hi,
I need help on using PEAR and PEAR DB. Please help me out. ------------------------------ First of all, these are the steps I have already taken. I installed PEAR on my website via ftp (with go-pear.php that is on pear.php.net) because Network Solutions, (my host) does not allow me to access php.ini I am 80% sure that PEAR DB came with go-pear. I see DB.php and DB folder in my /htdocs/libs/PEAR directory as I chose. I read examples from a book and wrote DBManager class and did some queries. ***** Note: My site uses PHP 4, not PHP 5. So, I wrote my classes without __CONSTRUCTOR, private and public keywords ------------------------------ Okay, so here is my problem. My website is going to be online store and well, the departments aren't displaying! (This is driving me nutz.) I get no errors and none of my database connection error messages are printed on the website so I assume DB connected fine. ----------------------------- Here is some of my code that is relevant to this. (I use the SMARTY template engine which I had no problems with so far) // config.inc.php php Code:
// database.php php Code:
|
|
#2
|
|||
|
|||
|
RE: need PEAR DB help
// department_list.tpl
// using SMARYY template engine {* departments_list.tpl *} {load_departments_list assign="departments_list"} {* start departments list *} <table border="0" cellpadding="0" cellspacing="1" width="200"> <tr> <td class="DepartmentListHead"> Choose a Department </td> </tr> <tr> <td class="DepartmentListContent"> {* loop through the list of departments *} {section name=i loop=$departments_list->mDepartments} {* verify if the department is selected to decide what CSS style to use *} {if ($departments_list->mSelectedDepartment == $departments_list->mDepartments[i].department_id)} {assign var=class_d value="DepartmentSelected"} {else} {assign var=class_d value="DepartmentUnselected"} {/if} {* generate a link for a new department in the list *} <a class="{$class_d}" href="{$departments_list->mDepartments[i].onclick}"> » {$departments_list->mDepartments[i].name} </a> <br/> {/section} </td> </tr> </table> {* end departments list *} |
|
#3
|
||||||||
|
||||||||
|
RE: need PEAR DB help
// do_catalog.php
php Code:
// bo_catalog.php php Code:
|
|
#4
|
|||||
|
|||||
|
RE: need PEAR DB help
// function.load_departments_list.php
php Code:
|
|
#5
|
|||||
|
|||||
|
RE: need PEAR DB help
// index.tpl
// SMARTY template php Code:
that's all of the templates and php files that uses PEAR DB. Other files are not relevant Please show me what I am doing wrong and why my queried-department list of my webaite are not showing up. - John |
|
#6
|
|||
|
|||
|
RE: need PEAR DB help
by the way, u might be wondering where header.tpl is. i do have it
this problem has to be an installation or algorithmic mistake. my syntax are all correct i believe a lot of the code i got from a book i am reading - John |
|
#7
|
||||
|
||||
|
RE: need PEAR DB help
This is more for my information -
Quick question - why did you make a wrapper class out of the DB class? All you are adding is another layer of abstraction with no (to me) added advantage. Oh - I also didn't see any references. Without them you are copying the data not getting a reference. |
|
#8
|
|||
|
|||
|
RE: RE: need PEAR DB help
Quote:
Well, it contains the error-handling code so after writing DBManager Class, I don't need to bother with that detail ever again I forgot to also show this. (I think this is the reference that you mean. I also have app_botton.php that simply closes the mysql // app_top.php |
|
#9
|
|||
|
|||
|
RE: need PEAR DB help
what exactly did you mean by reference?
im not sure |
|
#10
|
||||
|
||||
|
RE: need PEAR DB help
http://www.php.net/manual/en/language.references.php
And you might also want to see here - http://www.php.net/manual/en/language.oop.php I assume you are using php4 |
|
#11
|
|||
|
|||
|
RE: need PEAR DB help
Yes, I am using php4
Ok, I have thoroughly read those pages but I don't see why it wouldn;t work without references I am using $this operator and it says on the site "Note: There is no performance loss (since PHP 4 and up use reference counting) returning copies instead of references. On the contrary it is most often better to simply work with copies instead of references, because creating references takes some time where creating copies virtually takes no time (unless none of them is a large array or object and one of them gets changed and the other(s) one(s) subsequently, then it would be wise to use references to change them all concurrently). " |
|
#12
|
|||
|
|||
|
RE: need PEAR DB help
|
|
#13
|
|||
|
|||
|
RE: need PEAR DB help
why the heck is 'Object' being printed on the screen when i use PEAR's getCols() function?
|
|
#14
|
|||
|
|||
|
RE: need PEAR DB help
wow, holy crap it's not recognizing a dam function in PEAR
... |
|
#15
|
|||
|
|||
|
RE: need PEAR DB help
it passed the db::isError test so it is connected but WHY ON EARTH IS NOT RECOGNIZING numCols, numRows, getCols,, getRows etc
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > need PEAR DB help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|