我定义了<?php
$ini = parse_ini_file("../phpconfig.ini");
$conn = mysqli_connect($ini['hostaddress'], $ini['username'], $ini['password'], $ini['databasename']);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$options = ['cost' => 10,];
$number = mysqli_real_escape_string($conn, $_POST['number']);
$password = password_hash((mysqli_real_escape_string($conn, $_POST['password'])), PASSWORD_BCRYPT, $options);
$sql = "INSERT INTO usertemp (Employee_Number, Password)
VALUES ('$number', '$password')";
if (mysqli_query($conn, $sql)) {
$sql2 = "SELECT EXISTS(SELECT 1 FROM employee WHERE Number = '$number')";
$row2 = mysqli_query($conn, $sql2);
if (mysqli_num_rows($row2) > 0) {
//Has record in Employee table
header("location: display_createaccount_a.php");
} else {
//No record in Employee table
header("location: display_createaccount_b.php");
}
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
和import { ExponentLinksView } from '@exponent/samples';
类型的组件(这里的定义并不重要)。我需要以任何顺序(例如:文本,电子邮件,文本,文本)拥有任意数字inputText和/或inputEmail的inputTextType
集合。我试过了:
inputEmailType
但是在验证XML时
components
我有一个错误<xs:complexType name="componentsType">
<xs:choice>
<xs:element name="inputText" type="inputTextType" maxOccurs="unbounded" minOccurs="0"/>
<xs:element name="inputEmail" type="inputEmailType" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
</xs:complexType>
。 XML是正确的(我需要它)。我该如何修复XSD?
对于上面的XML,我将XSD更改为
<components>
<inputText>
<label>label 1</label>
<name>as</name>
</inputText>
<inputText>
<label>label 2</label>
<name>ghyyy6</name>
</inputText>
<inputEmail>
<label>drg</label>
<name>rgtght</name>
</inputEmail>
</components>
并且它有效,但后来我无法定义文本,电子邮件,文本,文本,只能先定义所有文本,然后是所有电子邮件。
答案 0 :(得分:1)
将出现次数限制移至xs:choice
:
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="inputText" type="inputTextType"/>
<xs:element name="inputEmail" type="inputEmailType"/>
</xs:choice>