我基本上编码了一个代码,该代码填充了我的数据库中的类别列表,然后您就可以选择要删除的类别.
我有删除代码的问题,由于错误似乎无法正常工作:
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
Run Code Online (Sandbox Code Playgroud)
造成这种情况的一行是:
if(isset($_POST['delete_id'] && !empty($_POST['delete_id']))) {
Run Code Online (Sandbox Code Playgroud)
deletecategory.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', …Run Code Online (Sandbox Code Playgroud) 我有三个文本字段,都是数字或十进制数字.
它们被接受为后来转换的字符串.
但是,我想验证这些字段,以便只接受数字或十进制数.
什么是最简单的方法来确保这些字段只是字符0-9.
我更喜欢if语句,但任何解决方案都会很好!
我想从一个活动中检索已保存到共享偏好的一些值,并希望在另一个活动中调用它.
基本上我如何从第一个活动中获取名称并自动在第二个活动的字段中显示它?
所以作为一个例子我有这个,它保存在首选项中.
public class Settings extends Activity {
EditText editText;
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
editText = (EditText) findViewById(R.id.editText);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new Button_Clicker());
loadSavedPreferences();
}
private void loadSavedPreferences() {
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(this);
String name = sharedPreferences.getString("name", "Your Name");
editText.setText(name);
}
private void savePreferences(String key, String value) {
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(this);
Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.commit();
}
class Button_Clicker implements Button.OnClickListener {
public void onClick(View v) { …Run Code Online (Sandbox Code Playgroud)