الفصل الثالث .
64
البرنامج النصي DBlib.php (تابع)
43.
44.
45.
46.
47.
48.
function queryDB ($db, $query) {
switch($db) {
case ("psql"):
if(!$result = @pg_exec($query)) {
$result = 0;
49.
}
50.
break;
51.
case ("mysql"):
52.
if(!$result
=
@mysql_query($query)) {
53.
54,
}
55.
56.
57.
58.
$result = 0;
break;
case("mssql"):
if(!$result = @mssql_query($query)) {
$result = 0;
59.
}
60.
break;
61.
default;
62.
63.
64.
}
65.
echo "<P>Invalid Database: $db";
$result = 0;
return $result;
66.
}
67.
68.
69.
70.
71.
72.
73.
74.
}
75.
76.
77.
78.
function returnDBarray($db, $result) {
if ($result = "error") {
switch($db) {
case ("psql"):
if(!$array = @pg_fetch_array($result)) { $array = 0;
break;
case ("mysql"):
if(!$array
=
@mysql_fetch_array($result)) {
$array = 0;
79.
}
ص٦٤