How to Create a Blog PHP & MySQL database #21 | validate and delete topics

preview_player
Показать описание
In this episode, we implement the delete topic functionality. We also validate topics and query them from the database to be displayed on the homepage.

Рекомендации по теме
Комментарии
Автор

Thanks Awa.♥ You are one in a million... Thanks for sharing. Personally, I found it difficult learning php, but you made it easier for me to understand how it works and easy to learn. God bless you bro. Thumbs up 👍

richiddraphael_
Автор

Code with Awa...Your'e obviously the best...I've just started following your tutorials for quite some time now... Your blog and your YouTube channel and you've actually been doing very well... The things you give freely here is what people are spending huge money to get on Udemy.

Thanks so much for the good work... I'll like to get to know you personally...

festusaihanunwa
Автор

Thanks Awa,

For replying about the 404 request, I am OK with that and I trust you for that.

Thanks once again for this video up here.

You really a blessing.

#AwaInspires us all.

Two Thumbs up!

urbaindesign
Автор

hi awa, . i have a same issu like
Mark Miller .when i am trying to update the topic description its show me Topic-Name already exists . so how i will update the topic???

shamimhasan
Автор

Hi Awa, after deleting the topics, it actually deletes from the table and database, but it shows some errors on the topics table like undefined variable $key.
Undefined variable $topic

iconic_robbott
Автор

Thank Awa, 19:34 how were you able to update the topic?. I can't cause in the validateTopic function it states $existingTopic = selectOne('topics', ['name' => $topic['name']]);. so it wont let me update an existing topic cause it keeps running into this line. I keep getting 'Name already exists' as a message.


validateTopic.php
function validateTopic($topic)
{
$errors = array();
if (empty($topic['name'])) {
array_push($errors, 'Name is required');
}
$existingTopic = selectOne('topics', ['name' => $topic['name']]);
if (isset($existingTopic)) {
array_push($errors, 'Name already exists');
}
return $errors;
}


topics.php


if {
$errors = validateTopic($_POST);

if (count($errors) === 0) {

$id = $_POST['id'];
unset($_POST['update-topic'], $_POST['id']);
$topic_id = update($table, $id, $_POST);
$_SESSION['message'] = 'Topic updated successfully';
$_SESSION['type'] = 'success';
header('location: ' . BASE_URL . '/admin/topics/index.php');
exit();
} else {
$id = $_POST['id'];
$name = $_POST['name'];
$description = $_POST['description'];
}
}

ivideogameboss
Автор

How to descending the array of my data extraction from database couse our query is primer exists in db folder how make it descending

AnaParwani-wqrt
Автор

Hello man, Why add descrption on the add topic if there is not description for topics in the main page???? only name. and in the manage topics page there is not description??? where do u see the description? thanks, nice tuto...

Diego_FPV
Автор

After implementing the topics.php my navbar doesnt display the username with the dropdown when i log in

emmanuelkusi
Автор

Is it possible to make a series of videos on the creation of a blog and forum with bootstrap?

ManiBssProduction
Автор

Sir please share written code some where in cloud or github plz

santoshsalam
Автор

The the you created behind the scene I can not create it just create one topic only

meleseberehannu
Автор

Hi Awa, When I try to update the description, I have a problem with Name already exists, and my description doesn't update.

NewsThatsUsed
Автор

Hi Awa, i have the issue, when i add a topic it added in database but when i try to add another topic i got success message on browser but it did not added in database and when i delete old one and add topic again then it works for only 1 post

JamshaidMannan
Автор

I can not create more topics as you doing behind the scene.

meleseberehannu
Автор

Thanks Awa.♥ You are one in a million... Thanks for sharing. Personally, I found it difficult learning php, but you made it easier for me to understand how it works and easy to learn. God bless you bro. Thumbs up 👍

richiddraphael_
join shbcf.ru