Jump to content


Photo

Include Files


  • Please log in to reply
4 replies to this topic

#1 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 20 December 2005 - 07:16 PM

I'm wanting to create some include files that display some recordset information but I found that when I drop and include file on a page that aready has another recordset on it I get errors. Anyone have any suggestions on how to do this. I thinking it is because it calls the connection file twice or something? Thanks


#2 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 20 December 2005 - 07:20 PM

The included file has a connection in it, right? Get rid of it. But then, that will cause some errors, because it can't connect to the database on that page; ignore those warning marks. I know it's hard to do, but you have to do it. Dreamweaver seems to have issues with include files-if you try to use their include browser, it will only cause problems. Includes files are things that need to be hard-coded because of the inherent glitchiness of it's PHP support.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#3 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 20 December 2005 - 08:52 PM

Right, so I really only need to have one connection per page regardless of how many includes I have. Should I put the include in the main page which has includes or what? Thanks

#4 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 21 December 2005 - 12:15 AM

Well the point is, when a file is included, it actually becomes part of that page's code. So to avoid calling the database many times, just have the connection string in the page calling the include file and not in any of the included files.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#5 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 21 December 2005 - 04:00 PM

Thanks, will do




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users