blob: b00de955bc59011cb53c25717264cb6ba14021dd [file] [log] [blame]
wdenkfe8c2802002-11-03 00:38:21 +00001<?php // php pages made with phpMyBuilder <http://kyber.dk/phpMyBuilder> ?>
2<?php
3 // (C) Copyright 2001
4 // Murray Jensen <Murray.Jensen@cmst.csiro.au>
5 // CSIRO Manufacturing Science and Technology, Preston Lab
6
7 // doedit page (hymod_bddb / boards)
8
9 require("defs.php");
10
11 pg_head("$bddb_label - Add Log Entry Results");
12
13 if ($serno == 0)
14 die("serial number not specified!");
15
16 if (isset($logno))
17 die("log number must not be set ($logno) when Creating!");
18
19 $query="update log set serno=$serno";
20
21 list($y, $m, $d) = split("-", $date);
22 if (!checkdate($m, $d, $y) || $y < 1999)
23 die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')");
24 $query.=", date='$date'";
25
26 if (isset($details))
27 $query.=", details='" . rawurlencode($details) . "'";
28
29 // echo "final query = '$query'<br>\n";
30
31 $sqlerr = '';
32
33 mysql_query("insert into log (logno) values (null)");
34 if (mysql_errno())
35 $sqlerr = mysql_error();
36 else {
37 $logno = mysql_insert_id();
38 if (!$logno)
39 $sqlerr = "couldn't allocate new serial number";
40 else {
41 mysql_query($query . " where logno=$logno");
42 if (mysql_errno())
43 $sqlerr = mysql_error();
44 }
45 }
46
47 if ($sqlerr == '') {
48 echo "<font size=+2>\n";
49 echo "\t<p>\n";
50 echo "\t\tA log entry with log number '$logno' was " .
51 "added to the board with serial number '$serno'\n";
52 echo "\t</p>\n";
53 echo "</font>\n";
54 }
55 else {
56 echo "\t<font size=+4>\n";
57 echo "\t\t<p>\n";
58 echo "\t\t\tThe following SQL error was encountered:\n";
59 echo "\t\t</p>\n";
60 echo "\t\t<center>\n";
61 printf("\t\t\t<b>%s</b>\n", $sqlerr);
62 echo "\t\t</center>\n";
63 echo "\t</font>\n";
64 }
65
66?>
67<p></p>
68<table width="100%">
69<tr>
70 <td align=center><a href="brlog.php?serno=<?php echo "$serno"; ?>">Go to Browse</a></td>
71 <td align=center><a href="index.php">Back to Start</a></td>
72</tr>
73</table>
74<?php
75 pg_foot();
76?>