7 |
|
|
8 |
|
|
9 |
// Establish a connection to the database server or bail out. |
// Establish a connection to the database server or bail out. |
10 |
$db_link = @mysql_connect ($db_server, $db_user, $db_password) |
$db_link = @xx_connect ($db_server, $db_user, $db_password) |
11 |
or die ( "ERROR: Could not connect to the database server." ); |
or die ( "ERROR: Could not connect to the database server." ); |
12 |
|
|
13 |
|
|
14 |
// Switch to the selected database name or bail out. |
// Switch to the selected database name or bail out. |
15 |
$db_switch = @mysql_select_db ($db_name, $db_link ) |
$db_switch = @xx_select_db ($db_name, $db_link ) |
16 |
or die ( "ERROR: Could not connect to the database." ); |
or die ( "ERROR: Could not connect to the database." ); |
17 |
|
|
18 |
|
|
19 |
/********************************************************** |
/********************************************************** |
20 |
Function: mysql_tryquery($querystring) |
Function: xx_tryquery($querystring) |
21 |
Author: Paul Bramscher |
Author: Paul Bramscher |
22 |
Last Modified: 03.02.2004 |
Last Modified: 03.02.2004 |
23 |
*********************************************************** |
*********************************************************** |
35 |
queries. If the $db_debug mode below is toggled on (1), |
queries. If the $db_debug mode below is toggled on (1), |
36 |
then additional error reporting is displayed. |
then additional error reporting is displayed. |
37 |
**********************************************************/ |
**********************************************************/ |
38 |
function mysql_tryquery($querystring) { |
function xx_tryquery($querystring) { |
39 |
|
|
40 |
// Database debug mode |
// Database debug mode |
41 |
$db_debug = 0; |
$db_debug = 0; |
42 |
|
|
43 |
// Determine whether the query was successful |
// Determine whether the query was successful |
44 |
$db_resource = @mysql_query($querystring); |
$db_resource = @xx_query($querystring); |
45 |
|
|
46 |
// Success. |
// Success. |
47 |
if ($db_resource) { |
if ($db_resource) { |
55 |
if ($db_debug == 1) { |
if ($db_debug == 1) { |
56 |
printf("<hr><b>DATABASE ERROR DEBUGGING</b><br><br>\n"); |
printf("<hr><b>DATABASE ERROR DEBUGGING</b><br><br>\n"); |
57 |
printf("<b>mySQL error:</b><br>\n(#%s) %s<br><br>\n", |
printf("<b>mySQL error:</b><br>\n(#%s) %s<br><br>\n", |
58 |
mysql_errno(), mysql_error()); |
xx_errno(), xx_error()); |
59 |
printf("<b>Attempted query:</b><br>\n%s<hr>\n", $querystring); |
printf("<b>Attempted query:</b><br>\n%s<hr>\n", $querystring); |
60 |
} |
} |
61 |
|
|
62 |
// Gracefully end the HTML stream |
// Gracefully end the HTML stream |
63 |
@mysql_query ("UNLOCK TABLES"); |
@xx_query ("UNLOCK TABLES"); |
64 |
die ("<br>The database is experiencing problems.</body></html>\n" ); |
die ("<br>The database is experiencing problems.</body></html>\n" ); |
65 |
} |
} |
66 |
|
|