If during styles import the CATEGORY_NUMBER is empty, insert 0 in the database instead.

Sat, 25 Sep 2021 10:42:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 25 Sep 2021 10:42:54 +0200
changeset 778
e64fd38c469c
parent 777
daf55c944fb0
child 779
67b1a07f4fd8

If during styles import the CATEGORY_NUMBER is empty, insert 0 in the database instead.

www/upl_styles.php file | annotate | diff | comparison | revisions
--- a/www/upl_styles.php	Sun Sep 12 20:35:04 2021 +0200
+++ b/www/upl_styles.php	Sat Sep 25 10:42:54 2021 +0200
@@ -56,8 +56,12 @@
 		$sql .= "', notes='" . mysqli_real_escape_string($db, $style->NOTES);
 	if ($style->CATEGORY)
 		$sql .= "', category='" . mysqli_real_escape_string($db, $style->CATEGORY);
-	if ($style->CATEGORY_NUMBER)
-		$sql .= "', category_number='" . $style->CATEGORY_NUMBER;
+	if ($style->CATEGORY_NUMBER) {
+		if (strlen($style->CATEGORY_NUMBER))
+			$sql .= "', category_number='" . $style->CATEGORY_NUMBER;
+		else
+			$sql .= "', category_number='0";
+	}
 	if ($style->STYLE_LETTER)
 		$sql .= "', style_letter='" . mysqli_real_escape_string($db, $style->STYLE_LETTER);
 	if ($style->STYLE_GUIDE)

mercurial