/[libdata]/trunk/include/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 /trunk/include/db_connect.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 42 - (hide annotations)
Thu Mar 4 22:43:50 2004 UTC (20 years, 1 month ago) by dpavlin
Original Path: trunk/db_connect.php
File size: 1138 byte(s)
rename all mysql_ functions to xx_ so that wrapper can be used

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 dpavlin 42 $con = xx_connect ( $db_srv, $db_usr, $db_pwd )
20 dpavlin 31 or die ( "ERROR: Could not connect to database server!" );
21 dpavlin 42 $result = xx_select_db ( $db_nam, $con )
22 dpavlin 31 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 dpavlin 42 $p_sql, xx_errno(), xx_error() );
33 dpavlin 31 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