删除脚本 [英] Delete Script

查看:96
本文介绍了删除脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我感谢你们对我的帮助以及我遇到的问题

。我是PHP和MySQL的新手,我在使用这个脚本工作时遇到了一些问题。我不能让这个工作,我不明白

为什么。我没有得到任何错误或任何错误,它几乎就像页面

刷新。我去了phpmyadmin,行仍然在

数据库中。 $ _GET部分在另一个脚本中完美运行,当我在其中插入硬值时,SQL

语句可以正常工作。任何想法都会非常感激。
非常感谢。在此先感谢。


< form method =" POST" action ="<?php print $ _SERVER [''PHP_SELF'']; ?>">

< table>


< tr>< td colspan =" 2" align =" center">是<?php

input_radiocheck(''radio'',''yes_no'',$ defaults,''yes''); ?没有<?php

input_radiocheck(''radio'',''yes_no'',$ defaults,''no''); ?>

< / td>< / tr>

< tr>< td colspan =" 2" align =" center"><?php input_submit(''save'',''Add''); ?>

< / td>< / tr>


< / table>

<输入类型= QUOT;隐藏"命名= QUOT; _submit_check" value =" 1" />

< / form>


<?php


function process_form(){


//在此函数中访问全局变量$ db

global $ db;


$ isbn = $ _GET [''isbn''];

$ artist_name = $ _GET [''artist_name''];

$ album_title = $ _GET [ ''album_title''];


if($ _POST [''yes_no''] ==''yes''){


$ delete_sql =" DELETE FROM lounge WHERE isbn = $ isbn AND artist_name =

\''$ artist_name \''AND album_title = \''$ album_title \''" ;

//删除记录

$ db->查询($ delete_sql);

print"记录被删除了;

}否则{

打印&记录未被删除;

}

}


?>

Hi everyone,

I appreciate all of your help with me and the problems I have been
having. I''m new to PHP and MySQL and I''m having some problems getting
this script to work. I can''t get this to work and I don''t understand
why. I don''t get an error or anything, it almost seems like the page
refreshes. I went to the phpmyadmin and the row is still in the
database. The $_GET parts work perfectly in another script and the SQL
statement works when I insert hard values in it. Any thoughts would be
greatly appreciated. Thanks in advance.

<form method="POST" action="<?php print $_SERVER[''PHP_SELF'']; ?>">
<table>

<tr><td colspan="2" align="center">Yes <?php
input_radiocheck(''radio'',''yes_no'', $defaults, ''yes''); ?No <?php
input_radiocheck(''radio'',''yes_no'', $defaults, ''no''); ?>
</td></tr>

<tr><td colspan="2" align="center"><?php input_submit(''save'',''Add''); ?>
</td></tr>

</table>
<input type="hidden" name="_submit_check" value="1"/>
</form>

<?php

function process_form() {

// Access the global variable $db inside this function
global $db;

$isbn = $_GET[''isbn''];
$artist_name = $_GET[''artist_name''];
$album_title = $_GET[''album_title''];

if ($_POST[''yes_no''] == ''yes'') {

$delete_sql = "DELETE FROM lounge WHERE isbn = $isbn AND artist_name =
\''$artist_name\'' AND album_title = \''$album_title\''";
// Delete the record
$db->query($delete_sql);
print "The record was deleted";
} else {
print "The record was not deleted";
}
}

?>

推荐答案

_GET零件工作完美在另一个脚本中,当我在其中插入硬值时,SQL

语句有效。任何想法都会非常感激。
非常感谢。在此先感谢。


< form method =" POST" action ="<?php print
_GET parts work perfectly in another script and the SQL
statement works when I insert hard values in it. Any thoughts would be
greatly appreciated. Thanks in advance.

<form method="POST" action="<?php print


_SERVER [''PHP_SELF'']; ?>">

< table>


< tr>< td colspan =" 2" align =" center">是<?php

input_radiocheck(''radio'',''yes_no'',
_SERVER[''PHP_SELF'']; ?>">
<table>

<tr><td colspan="2" align="center">Yes <?php
input_radiocheck(''radio'',''yes_no'',


默认值,''是''); ?没有<?php

input_radiocheck(''radio'',''yes_no'',
defaults, ''yes''); ?No <?php
input_radiocheck(''radio'',''yes_no'',


这篇关于删除脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆