Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I delete a row with a <a href... link???

Status
Not open for further replies.

juuso79

Programmer
Nov 15, 2001
22
FI
I have made this switch and I try to use it with this href-link I only want to delete one row but it doestn work!!!

Please Help!!

/////////////////////////////////////////////////////
<a href=uusi.php?a=delete&ID_number='$a_row[0]'> <i>Delete . '$a_row[0]'</i></a>
///////////////////////////////////////////////////////
switch($a)
{

CASE &quot;delete&quot;:
mysql_query(&quot;DELETE FROM uutiset2 WHERE ID_luku = '$b_row[0]'&quot;);
printf (&quot;Records deleted: %d\n&quot;, mysql_affected_rows());

BREAK;
}
/////////////////////////////////////////////////////
 
Does this:

&quot;DELETE FROM uutiset2 WHERE ID_luku = '$b_row[0]'&quot;

create the string you thing it does? I see that the input parameter form the form submission is ID_number, but you refer to a variable $b_row;
 
If you do:

$mystring = &quot;DELETE FROM uutiset2 WHERE ID_luku = '$b_row[0]'&quot;;

print $mystring;

What do you get?
 
DELETE FROM uutiset2 WHERE ID_luku = ''

and nothing else?
 
Then $b_row[0] does not contain the value you need.

From the URL you describe in your initial post, the row id of the row you want to delete is in ID_number.

As that point do you move the data into $b_row[0]?
 
My problem was that I tryed to put the $b_row[0] table value to single integer. When I tryed

<a href=uusi.php?a=delete&ID_number[0]='$a_row[0]'> <i>Delete . '$a_row[0]'</i></a>

it worked (stupid me) :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top