delete data coding..

hi…i try to delete the data by hit the delete button…but no changes…here i submit my coding…
[php]

<?php if (isset($_REQUEST['delete'])) $select ="DELETE from details where amount = $nt[amount]" mysql_query($select) or die('Error, delete query failed');?>

[/php]…sumone please help me…

i have try so many ways…but cannot…please help me…
[php]

<?php $sql = "select *from details"; $query = @mysql_query($sql); $countData = @mysql_num_rows($query); ?>
<td width="62" bgcolor="#CAF3F7"><div align="center" class="style12"><?php while ($nt=mysql_fetch_array($query))

{
echo "delete
";
}?>

<?php if (isset($_REQUEST['delete'])) $select ="DELETE from details where amount = $nt[amount]"; $querys = @mysql_query($select); $countDatas = @mysql_num_rows($querys); ?>

[/php]…i try this coding…but nothing happen…i realy dunnu

Well, what errors did you get? Or did you not get any errors? Have you tried putting curly braces around whatever’s supposed to be inside the if statements?

They wouldn’t get any errors with the @ in front of everything as that will suppress errors.

[php]

<?php $sql = "select * from details"; $query = @mysql_query($sql); $countData = @mysql_num_rows($query); ?>

// @ is suppressing any errors the script is going to pass.
[/php]

Should be -

[php]

<?php $sql = "select *from details"; $query = mysql_query($sql); $countData = mysql_num_rows($query); ?>

[/php]

Unsupress everything run and see what errors you are getting. Then if you still can’t figure it out, come back to us with the error and we can try and help.

Sponsor our Newsletter | Privacy Policy | Terms of Service