Example #1
0
if (!($stmt = $mysqli->prepare($sql))) {
    # echo "Prepare failed: (" . $mysqli->errno. ") " . $mysqli->error;
    myPrintError('lpl-prepare', $mysqli->errno);
}
$stmt->bind_param('s', $usr);
if (!$stmt->execute()) {
    # echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
    myPrintError('lpl-execute', $stmt->errno);
}
$id = NULL;
$user = NULL;
$container = NULL;
$plant = NULL;
if (!$stmt->bind_result($id, $user, $container, $plant)) {
    # echo "Binding output parameters failed: (" . $stmt->errno . ") " . $stmt->error;
    myPrintError('lpl-bindres', $stmt->errno);
}
echo '            <thead>';
echo '              <tr>';
echo '                <th>#</th>';
echo '                <th>Username</th>';
echo '                <th>Container</th>';
echo '                <th>Plant</th>';
echo '              </tr>';
echo '            </thead>';
echo '            <tbody id=addRows>';
while ($stmt->fetch()) {
    echo '              <tr>';
    printf("                <td>%s</td>\n", $id);
    printf("                <td>%s</td>\n", $user);
    printf("                <td>%s</td>\n", $container);
Example #2
0
$cnt = 0;
while ($stmt->fetch()) {
    $cnt++;
}
if ($cnt > 0) {
    echo '<div class="alert alert-danger alert-dismissible" role="alert">
              <button type="button" class="close" data-dismiss="alert" aria-label="Close">
              <span aria-hidden="true">&times;</span></button>
              <h4>Error!</h4>
              <p>Username "' . $outName . '" is already in use. Please try again.</p></div>';
    die;
}
# $sql = "INSERT INTO `ratlifri-db`.`accounts` (`id`, `username`, `password`)
$sql = "INSERT INTO `petleya-db`.`zuser` (`uid`, `username`, `password`) \n            VALUES (NULL, '{$usr}', '{$psw}');";
if (!($stmt = $mysqli->prepare($sql))) {
    # echo "Prepare failed: (" . $mysqli->errno. ") " . $mysqli->error;
    myPrintError('s2-prepare', $mysqli->errno);
}
if (!$stmt->execute()) {
    # echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
    myPrintError('s2-execute', $stmt->errno);
}
echo '<div class="alert alert-success alert-dismissible" role="alert">
          <button type="button" class="close" data-dismiss="alert" aria-label="Close">
          <span aria-hidden="true">&times;</span></button>
          <h4>Success!</h4>
          <p>You have successfully signed up. Now login to start a session and to enter the site.</p>
          <p>
          <button type="button" class="btn btn-success" onclick=loadLogin()>Go to Login</button>
          </p>
          </div>';