annotate mq.php @ 47:2a3943ced610

centralise db query even more
author Charlie Root
date Sun, 06 Jan 2019 12:17:05 -0500
parents
children a67bf725e87b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
1 <?php
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
2 function my_query($q,$d='x')
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
3 {
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
4 global $link;
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
5 $res = mysqli_query($link, $q);
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
6 if ($res) {
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
7 return $res;
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
8 }
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
9 else {
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
10 $err=mysqli_error( $link );
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
11 mysqli_close($link);
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
12 include_once "ywww/dlog.php";
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
13 dl("query from $d failed: $q\n$err\n");
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
14 exit($err);
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
15 }
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
16 }
2a3943ced610 centralise db query even more
Charlie Root
parents:
diff changeset
17 ?>