amedhussaini Posted April 24, 2008 Share Posted April 24, 2008 Can someone here past their include file they use to initialize their databases? I'm having trouble abstracting all my connect statements.. as it stands right now, i do the whole: $mysqli = mysqli_connect("...... etc everytime Cheers, amed Link to comment https://forums.phpfreaks.com/topic/102639-mysqli_connect-abstracted-into-include-file-help/ Share on other sites More sharing options...
ublapach Posted April 24, 2008 Share Posted April 24, 2008 ya here you go <?php $dbc=@mysql_connect("localhost", "usrename", "password") or die ("The Database server is unavailable."); if (!@mysql_select_db("Database Name", $dbc)) { die ("The database is unavailable."); } ?> Link to comment https://forums.phpfreaks.com/topic/102639-mysqli_connect-abstracted-into-include-file-help/#findComment-525662 Share on other sites More sharing options...
amedhussaini Posted April 24, 2008 Author Share Posted April 24, 2008 thanks man. anyone have a function that does similar? Link to comment https://forums.phpfreaks.com/topic/102639-mysqli_connect-abstracted-into-include-file-help/#findComment-525693 Share on other sites More sharing options...
jonsjava Posted April 24, 2008 Share Posted April 24, 2008 why function it? create a file, named "sql.inc.php" or something. add that data to the file, then include it when needed. Link to comment https://forums.phpfreaks.com/topic/102639-mysqli_connect-abstracted-into-include-file-help/#findComment-525697 Share on other sites More sharing options...
amedhussaini Posted April 24, 2008 Author Share Posted April 24, 2008 thanks.. yeah, i know, all i have to do is include it.. but i was *trying* to do a function based one and couldn't get it to work.. i'd like to see what one that works looks like hehe Link to comment https://forums.phpfreaks.com/topic/102639-mysqli_connect-abstracted-into-include-file-help/#findComment-525760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.