barkster Posted December 20, 2005 Share Posted December 20, 2005 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 Quote Link to comment https://forums.phpfreaks.com/topic/3080-include-files/ Share on other sites More sharing options...
moberemk Posted December 20, 2005 Share Posted December 20, 2005 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. Quote Link to comment https://forums.phpfreaks.com/topic/3080-include-files/#findComment-10283 Share on other sites More sharing options...
barkster Posted December 20, 2005 Author Share Posted December 20, 2005 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 Quote Link to comment https://forums.phpfreaks.com/topic/3080-include-files/#findComment-10285 Share on other sites More sharing options...
moberemk Posted December 21, 2005 Share Posted December 21, 2005 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. Quote Link to comment https://forums.phpfreaks.com/topic/3080-include-files/#findComment-10287 Share on other sites More sharing options...
barkster Posted December 21, 2005 Author Share Posted December 21, 2005 Thanks, will do Quote Link to comment https://forums.phpfreaks.com/topic/3080-include-files/#findComment-10298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.