[06-Sep-2022 05:15:00 UTC] PHP Notice: Undefined index: username in /home/patedfrb/public_html/affiliateproduct/do_register.php on line 7
[06-Sep-2022 05:15:00 UTC] PHP Notice: Undefined index: username in /home/patedfrb/public_html/affiliateproduct/do_register.php on line 17
[06-Sep-2022 05:15:00 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'username' cannot be null in /home/patedfrb/public_html/affiliateproduct/do_register.php:18
Stack trace:
#0 /home/patedfrb/public_html/affiliateproduct/do_register.php(18): PDOStatement->execute(Array)
#1 {main}
thrown in /home/patedfrb/public_html/affiliateproduct/do_register.php on line 18
<?php
require_once __DIR__.'/boot.php';
// Проверим, не занято ли имя пользователя
$stmt = pdo()->prepare("SELECT * FROM `admin` WHERE `username` = :username");
$stmt->execute(['username' => $_POST['username']]);
if ($stmt->rowCount() > 0) {
flash('Это имя пользователя уже занято.');
header('Location: /'); // Возврат на форму регистрации
die; // Остановка выполнения скрипта
}
// Добавим пользователя в базу
$stmt = pdo()->prepare("INSERT INTO `admin` (`username`, `password`) VALUES (:username, :password)");
$stmt->execute([
'username' => $_POST['username'],
'password' => password_hash($_POST['password'], PASSWORD_DEFAULT),
]);
header('Location: login.php');
<div class="container w-100 p-3">
<div class="row justify-content-center">
<div class="col-4">col-4</div>
<div class="col-8">
<form class="row justify-content-center">
<div class="col-8">
<label for="inputPassword2" class="visually-hidden">URL</label>
<input type="text" class="form-control" id="inputUrl" placeholder="Url">
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary mb-3">Open</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-8">
public class MaxArrayValue {
int[] numbers = {1, 7, 5, 2, 4};
public static int getMaxNumber(int[] numbers) {
//Write code below this line
int max = 1;
for(int i = 0; i < numbers.length; i++) {
System.out.println(numbers[i]);
}
return numbers[i];
}
}
i
я получаю индекс массива private void PutDataIntoRecyclerView(List<CategoryModel> categoryList) {
CategoryAdapter categoryAdapter = new CategoryAdapter(getContext(), categoryList);
binding.recyclerMain.setLayoutManager(new LinearLayoutManager(getContext()));
binding.recyclerMain.setAdapter(categoryAdapter);
}
interface IItemClick {
public void onClick(int id);
}
IItemClick itemClick
сразу предлагает импортировать класс HomeFragment. После импорта класса в конструкторе следующая ошибкаassert mNotificationManager != null;
mNotificationManager.notify(1, mBuilder.build());
mNotificationManager.notify((int) id, mBuilder.build()); что здесь id? тоже непонятноid берется из констант. в MainActivity оно же выводит записи.
try {
Long id = mBundle.getLong(Constants.id);
if (id!=null && id>0)
databaseWriteExecutor.execute(() -> {
NoteDao dao = INSTANCE.noteDao();
addNote(dao.getNoteById(id));
});
}catch (Exception e){
Log.e(TAG, "onCreate: "+e);
}