- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在某些新闻网站上的编辑按钮遇到了一些问题...欢迎任何类型的帮助...这是我的代码..我将忽略不相关的代码
admin_first.php
<?php
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_BASE);
$query = "SELECT * FROM news ORDER BY id";
$result = mysqli_query($connection, $query);
while($row = mysqli_fetch_array($result))
{
$id[] = (int) $row['id'];
$header[] = htmlspecialchars($row['header']);
$text[] = htmlspecialchars($row['text']);
$picture[] = htmlspecialchars($row['pictures']);
$date[] = $row['time'];
}
if(mysqli_num_rows($result) != 0)
{
for($i=0; $i<count($id); $i++)
{
echo '<div class="new_item"><h2>' . $header[$i] . '</h2><p class="text">' . $text[$i] . '</p><a href="' . $picture[$i] . '" target="_blank"><img src="' . $picture[$i] . '"/></a><p class="time">' . $date[$i] . '</p></div>
<div class="buttons"><form><input type="button" name="delete" id="delete" onclick="window.location.href=\'process_buttons.php?delete=' . $id[$i] . '\'"
value="Obri�i vest"/><input type="button" name="edit" id="edit" onclick="window.location.href=\'process_buttons.php?edit=' . $id[$i] . '\'" value="Izmeni vest"/></form></div>';
}
}
mysqli_close($connection);
?>
这是
process_buttons.php
<?php
include 'functions.php';
include 'constants.php';
is_logged_in("admin.php");
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_BASE);
$safe_id = filter_input(INPUT_GET, 'delete', FILTER_SANITIZE_STRING);
if(!empty($_GET['delete']))
{
$query = "DELETE FROM news WHERE id='{$safe_id}'";
$result = mysqli_query($connection, $query) or die(mysqli_error());
header("Location: admin_first.php");
}
else
{
?>
这是删除部分,工作正常..
问题出在这部分:
<?php
$safe_id = (int) $_GET['edit'];
$query = "SELECT * FROM news WHERE id='{$safe_id}'";
$result = mysqli_query($connection, $query);
while($row = mysqli_fetch_array($result))
{
$header = htmlspecialchars($row['header']);
$text = nl2br(htmlspecialchars($row['text']));
$picture = $row['picture'];
header("Location: admin_first.php");
}
?>
提前致谢...
最佳答案
我在您提到的问题部分中没有看到任何更新查询及其执行部分。在这种情况下,
您需要使用更新查询将记录更新到 MySQL 表中。
语法是,
Update tablename set columnname='value' where id='value'
关于PHP - 更新新闻错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19864844/
我最近开始接触网络编程,我完全不知所措。我已经开始学习基础知识、html、css 和 javascript。在我的第一个网页上,我有兴趣为我发布更新的地方实现一个下拉新闻部分。我能举出的最好的例子就是
我的 Wordpress 主题在我放大评论框时没有扩展其内容区域,因此整个内容都在页脚上。页脚保持固定在页面底部,但当我展开评论框时不会自行向下推... 我尝试阅读其他问题,但我没有解决那个问题。 代
我正在运行 TYPO3 V6 和最新版本的 tx_news(不是 tt_news),当我尝试更改 LIST 显示的排序顺序时,插件中的设置不会覆盖 Typoscript 设置。似乎没有办法更改 Lis
根据 Google 允许您的文章/新闻出现在 Google 新闻中: Display a three-digit number. The URL for each article must conta
我想问一下是否可以使用表单提交后发送到用户邮件的唯一代码创建注册,我不确定如何正确地做。 for example : The user enters his email and the system
我目前正在使用在 Google 新闻语料库上训练的 Word2Vec 模型(来自 here)由于这只针对 2013 年之前的新闻进行训练,因此我需要根据 2013 年之后的新闻更新向量并在词汇表中添加
所有的麻烦都开始了,我无法按画廊的右箭头(右箭头出现在图片中) 我看到只有当我将栏移到右侧时,我才能点击箭头。 如您所见,我在 Firefox 中打开了 F12,指向了网站的右侧部分。 我看到它是空的
我有一些代码运行良好,它只是添加了一个水平新闻提要(或我列出的任何信息)它运行良好,没有闪烁,但是当我向它添加更多数据时,它似乎需要一段时间才能加载并且速度变化?我还有很多信息要添加到其中,但我不想在
我有点坚持 RewriteRule 301,从旧新闻 ID 更改为新新闻 ID 这是我尝试过的: RewriteRule ^/news/0(.*)$ /news/$1 [L,R=301] 假设新闻 U
我对 Google 新闻 RSS 提要的使用有疑问。 Google 新闻帮助说明了这一点: Why Google might block an RSS feed In some cases, Goog
我想在我的网站上加入新闻,但主要主题必须是“书籍”或“作者”等。基本上,我需要选择我提到的这两个或作者姓名等自定义主题。 但我不知道怎么做,因为文档真的很差(或者我找不到)。 添加它的查询参数是什么?
最好的方法是什么? 我想解析新闻,然后使用关键字之类的内容过滤它们并找到匹配项。 有人已经这样做了吗?而且,这是合法的吗? 最佳答案 您可以使用 google 新闻网址 http://news.goo
我有一个获取热门新闻头条的 js 函数。它已按 promise 返回,但我无法访问这些文章。这是我的代码 function news09() { var url = 'https://ne
我想让我的 TableView 加载更多动画,例如 Facebook 新闻,并在底部显示动画指示器事件。 有什么指导可以帮助我做到这一点吗?谢谢。 最佳答案 有几种方法可以做到这一点 在最后一个 in
我正在为我的网站创建一个新闻系统。我有一个主页 {index.php}(显示所有文章)和一个文章页面 (article.php) 我遇到的问题是在文章页面上选择内容。 当你点击 index.php 上
我已成功调用新闻 API 并将结果放入 DataFrame,但仅限于第 1 页。 def get_articles(keyword): all_articles = newsapi.get_eve
我有一个适合我网站的新闻 slider ,我想使用它,但我遇到了一个小问题。完成 HTML 和 CSS 后,我需要旋转“展示柜”,现在我已经尝试使用 Jquery 的不同指令,但一点运气都没有。有人可
因此,我必须根据编写的 javascript 文件(如下)创建搜索查询,并且还必须使用此 URL 来创建搜索查询。在 URL 末尾,您可以添加任何您喜欢的搜索词。例如,我们将搜索食物:https://
我在 TYPO3 8.7.13 中使用来自 Georg Ringer 的新闻扩展。 如果没有选择图像进行预览,扩展程序会显示一个虚拟图像。是否可以改用文章中的第一张图片? 谢谢 最佳答案 当然,您需要
我是typo3 的新手,我需要有关新闻扩展和$TCA 配置的帮助。 我做了一个名为“Activité”的扩展,它从 News 扩展而来。这很顺利。我创建了一些自定义字段,并且能够从“常规”选项卡中已经
我是一名优秀的程序员,十分优秀!