/[libdata]/branches/paul_xx/db_connect.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /branches/paul_xx/db_connect.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations)
Thu Mar 4 21:18:33 2004 UTC (18 years, 2 months ago) by dpavlin
Original Path: trunk/db_connect.php
File size: 1150 byte(s)
Initial revision

1 dpavlin 31 <?php
2    
3     /****************************************************************/
4    
5     /* constants */
6     $DEBUG = 0;
7    
8     /****************************************************************/
9    
10     /* database parameters */
11     $db_nam = "libdata";
12     $db_srv = "localhost";
13     $db_usr = "libdata";
14     $db_pwd = "libdatapw";
15    
16     /****************************************************************/
17    
18     /* establish a connection to the database or bailout */
19     $con = mysql_connect ( $db_srv, $db_usr, $db_pwd )
20     or die ( "ERROR: Could not connect to database server!" );
21     $result = mysql_select_db ( $db_nam, $con )
22     or die ( "ERROR: Could not connect to database!" );
23    
24     /****************************************************************/
25    
26    
27     /* some useful functions */
28    
29     /* return an error message from a failed sql query */
30     function sql_err ( $p_sql ) {
31     printf ( "ERROR: Query failed.<br>%s<br>%s: %s<br>\n",
32     $p_sql, mysql_errno(), mysql_error() );
33     return 1;
34     }
35    
36     /* finish off the html stream and die */
37     function bailout() {
38     die ( "Bailing Out!<br>\n</body></html>\n" );
39     }
40    
41    
42     ?>

  ViewVC Help
Powered by ViewVC 1.1.26