+
+ /**
+ * Function for quoting values before saving
+ * @param string $value string that has to be quoted
+ * @param string quoted string
+ */
+ function quotevalue($value) {
+ /* Quote the field if it contains | or ". Double quotes need to
+ * be replaced with "" */
+ if(ereg("[|\"]", $value)) {
+ $value = '"' . str_replace('"', '""', $value) . '"';
+ }
+ return $value;
+ }
+