Skip to content

Commit

Permalink
bug fixxed
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulK4102 committed Oct 7, 2023
1 parent bc8da63 commit 53cd6e0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
18 changes: 13 additions & 5 deletions text_keep/Text_keep.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
if (isset($_POST['add'])) {
$heading = $_POST['heading'];
$content = ($_POST['content']);
$text->insert('data', ['acount_id' => $id, 'heading' => $heading, 'content' => $content]);
if ($heading && $content) {
$text->insert('data', ['acount_id' => $id, 'heading' => $heading, 'content' => $content]);
}elseif (!$heading){
echo "Heading is empty";
}elseif (!$content){
echo "Content is empty";
}
}
if (isset($_GET['delete_id'])) {
$id = $_GET['id'];
Expand All @@ -15,7 +21,9 @@
}
if (isset($_POST['search_item'])) {
$search_item = $_POST['search'];
$search = $text->display1('data', 'heading=' . $search_item);
$result = " \"$search_item\"";
echo $result;
$search = $text->display1('data', 'heading=' . $result);
foreach ($search as $row) {
$id = $row['id'];
$acount_id = $row['acount_id'];
Expand All @@ -33,13 +41,13 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="text.css">
<link rel="stylesheet" href="text.css?">
<title>Text Keep</title>
</head>

<body>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
<a class="navbar-brand" href="#">Text Keep</a>
<a class="navbar-brand" href="Text_keep.php?id=<?php echo $id; ?>">Text Keep</a>
<?php
if (isset($_GET['id'])) {
foreach ($register as $row) {
Expand Down Expand Up @@ -122,7 +130,7 @@
>
<span id="spam"><?php echo $row['heading']; ?></span>
<span><?php echo $row['content'] ?></span>
<a class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" style="display: flex;" href='delete.php?delete_id=<?php echo $current_id ?>&id=<?php echo $acount_id ?>' > DELETE </a>
<a class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href='delete.php?delete_id=<?php echo $current_id ?>&id=<?php echo $acount_id ?>' > DELETE </a>
</div>
<?php
}
Expand Down
2 changes: 1 addition & 1 deletion text_keep/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function insert($table,$param=array()){
$table_columns = implode(',',array_keys($param));
$data = implode("','",$param);
$sql = "INSERT INTO $table ($table_columns) VALUES ('$data')";
echo $sql;

if($this->mysqli->query($sql)){
array_push($this->result,$this->mysqli->insert_id);
return true;
Expand Down
6 changes: 3 additions & 3 deletions text_keep/searched.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="text.css">
<link rel="stylesheet" href="text.css?">
<title>Text Keep</title>
</head>

<body>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
<a class="navbar-brand" href="#">Text Keep</a>
<a class="navbar-brand" href="Text_keep.php?id=<?php echo $registered_id; ?>">Text Keep</a>
<?php
if (isset($_GET['id'])) {
foreach ($register as $row) {
Expand Down Expand Up @@ -118,7 +118,7 @@
>
<span id="spam"><?php echo $row['heading']; ?></span>
<span><?php echo $row['content'] ?></span>
<a href='Text_keep.php?delete_id=<?php echo $current_id ?>&id=<?php echo $acount_id ?>'><button>DELETE</button></a>
<a class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href='delete.php?delete_id=<?php echo $current_id ?>&id=<?php echo $acount_id ?>'>DELETE</a>
</div>
<?php
}
Expand Down
3 changes: 3 additions & 0 deletions text_keep/text.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,7 @@ span {
height: 5px;
left: 0px;
top: 10px;
}
a{
color: red;
}

0 comments on commit 53cd6e0

Please sign in to comment.