- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我基本上编写了一个代码,该代码从我的数据库中填充类别列表,然后您可以选择要删除的类别。
我有删除代码的问题,由于错误,它似乎不起作用:
Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in F:\xamppnew\htdocs\650032\admin\delete.php on line 6
导致这个的行是:
if(isset($_POST['delete_id'] && !empty($_POST['delete_id']))) {
删除类别.php
<h3>
Delete Category
</h3>
<?php $result = mysql_query("SELECT * FROM category"); ?>
<table>
<?php while($row = mysql_fetch_array($result)) : ?>
<tr id="<?php echo $row['category_id']; ?>">
<td><?php echo $row['category_Name']; ?></td>
<td>
<button class="del_btn" rel="<?php echo $row['id']; ?>">Delete</button>
</td>
</tr>
<?php endwhile; ?>
</table>
<script>
$(document).ready(function(){
$('.del_btn').click(function(){
var del_id = $(this).attr('rel');
$.post('delete.php', {delete_id:del_id}, function(data) {
if(data == 'true') {
$('#'+del_id).remove();
} else {
alert('Could not delete!');
}
});
});
});
</script>
删除.php
<?php
if(isset($_POST['delete_id'] && !empty($_POST['delete_id']))) {
$delete_id = mysql_real_escape_string($_POST['delete_id']);
$result = mysql_query("DELETE FROM category WHERE `id`=".$delete_id);
if($result !== false) {
echo 'true';
}
}
?>
最佳答案
你错过了这个)
:
if(isset($_POST['delete_id']) && !empty($_POST['delete_id']))
^---
关于php - Isset表达式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23205968/
我有以下不能正常工作的 $_GET['category'] 也可以等于 0。 if ( empty( $_GET['category'] ) ){ // do something } else
我最近被安排做一个需要一些PHP的项目,我对PHP了解不多。站点中有几个实例,单击按钮后,用户会被重定向到带有一些 URL 参数的另一个页面。然后下一页使用 $_GET 获取这些参数并继续。 代码中的
如果我使用此代码将数字作为输入,它可以正常工作 Hours: Hours: Minutes: Hours: Minutes
我希望扩展我的 PHP 知识,但我遇到了一些我不确定它是什么或什至不知道如何搜索它的东西。我正在查看 php.net isset 代码,我看到了 isset($_GET['something']) ?
isset($var) == "Test" 和 isset($var) && $var == 'Test" 有什么区别? 最佳答案 这里是一个简短的例子: $var = "Chuck Test"; v
isset($var) == "Test" 和 isset($var) && $var == 'Test" 有什么区别? 最佳答案 这里是一个简短的例子: $var = "Chuck Test"; v
例如,如果我实现一些简单的对象缓存,哪种方法更快? 1. return isset($cache[$cls]) ? $cache[$cls] : $cache[$cls] = new $cls; 2.
{if isset({$LANG.domainmoreinfo}){$LANG.domainmoreinfo}{/if} 这似乎是一个不正确的语法,有人能告诉我我做错了什么吗? 也许我们不能在“$LA
这个问题在这里已经有了答案: Weak typing in PHP: why use isset at all? (9 个回答) 关闭 6 年前。 我是 PHP 的初学者,想知道这之间有什么区别 $
根据文档 isset 条款“测试此项目中是否已设置给定属性”。我不明白设置属性时 isset 返回 true 还是 false 在下面的代码片段中,当 env.JAVA_HOME 未设置时,java.
这个问题在这里已经有了答案: Search nested object for property (4 个答案) 关闭 2 年前。 我找不到与我的问题非常相似的问题,但如果你能找到一个,请随时告诉我
有人可以帮助我学习 PHP 吗?我想创建简单的表单,并在添加“isset 函数”后返回所有表单。 Monitors Graphics Peripher
当我打印它时,我有 $list 然后我得到以下输出 AWeberEntry Object ( [_privateData:protected] => Array ( [0] =
知道 PHP 的 memcached 模块是否支持某种 isset() 方法吗? 以下案例: Memcached::set('foo', false); if(Memcached::get('foo'
我正在阅读“Head First PHP & MySQL”一书,书中的许多部分都有用于处理 HTML 表单的代码片段。他们是这样开始的: if (isset($_POST['submit'])){ .
有没有一种快捷方式可以将$_GET['values']赋值给变量? 我现在和其他人一样: if(isset($_GET['type'],$_GET['case']) $type = $_GET[
知道 PHP 的 memcached 模块是否支持某种 isset() 方法吗? 以下案例: Memcached::set('foo', false); if(Memcached::get('foo'
我有一个表格 > Note Add More Notes Next call date
这是我的Python代码: if onerow[0]['result'] is None or not result['GetOdds'][0]['result']is None: 当result为空
我创建了一个 isset 函数来检查变量是否已定义且不为空。这是我的代码: isset = function(a) { if ((typeof (a) === 'undefined') ||
我是一名优秀的程序员,十分优秀!