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 Quote Link to comment 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."); } ?> Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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.