| Home > Computer & I'net > Include... |
|
|
|||||||||||||
|
|
|||||||||||||
|
||||||||||||||
Include | |
The first part of server connection, database selection, and table selection is a repeated snippit, so to save time and effort, we'll put that part into a seperate file and just call it into play when we need it. db_connect.inc <?php // set your infomation. $dbhost='localhost'; $dbusername='david'; $dbuserpass='mypassword'; $dbname='test'; // connect to the mysql database server. $link_id = mysql_connect ($dbhost, $dbusername, $dbuserpass); // select the specific database name we want to access. $dbname=$dbusername."_".$dbname; if (!mysql_select_db($dbname)) die(sql_error()); ?> The PHP command to call that section of code into action : include ("db_connect.inc");
----------------- Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission. | |
| Articles |
•Auto & Trucks•Business•Computer & I'net·General·Apache·CSS·Database·Hardware·HTML·Javascript&DHTML·LinuxMySQL·Operating System·Perl / CGI·PHP·Programming·Publishing·Search Engines·Software Problems·SSI·Tips & Tricks·Utilities·Web Design•Family•Food & Drink•Gardening•Health•Other•Pets•Psychology•Spiritual•Travel•Women |
| Calculators |
|