Jump to content
php.lv forumi

Dzēst ierakstus no db


Recommended Posts

Man ir problēma ar ierakstu dzēšanu no datubāzes. Nestradā tāda iespēja ,ka var dzēst tos ierakstus kuri tiek atzīmēti ar checkbox.


$123=mysql_query("select * from msg where send='$lietotajs") or die(mysql_error());
<form name="checkbox" method="post" action ="del.php">
<input type="checkbox" name=<?php $delete ?> value=<?php $delete ?> ></td></tr>
<input type="submit" name="delete" value="Dzēst">



header ("location: index.php");
$checked = $_POST['$delete']; 

$count = count($checked); 
for($i=0; $i < $count; $i++) 
$query = "DELETE FROM msg WHERE id=$checked"; 



kad checkbox nomaina pret type=text, un ieraksta ar roku vērtību, tad viss strādā. Problēma ir tajā, ka ar $_POST['$delete']; netiek iegūta msg id. Kas tiesi tur ir nepareizi, kādēļ ar checkbox vertību neiegūst bet ar input type=text vērtība tiek iegūta?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...