Jump to content
php.lv forumi

Dzēšana no sql


drellout

Recommended Posts

Labs vakars... Es gribētu jums paprasīt, vai drizāk palūgt lai kāds varētu pateikt kā var izdzēst kko no sql neieejot viņa ar kādu kodu

Man bija doma izveidot kaut ko tādu

<strong>Ko dzēst ?</strong><br>
 <select name="clanwars" size="1" >
   <option value="1aiscw">1tm vs 2tm</option>
   <option value="2aiscw">1tm vs 2tm</option>
..... un tadaa garaa lai pats liek cik ir
 </select>
 </form>

Lai viņš velk ārā cik ir tie piemēram clanwari un izvēloties viņu un tad uzspiežot pogu dzēst viņš izdzēšās

 

Pašam ir tāds sql fails

CREATE TABLE `cw` (
 `km2` text NOT NULL,
 `km1_rez` text NOT NULL,
 `km2_rez` text NOT NULL,
 `km2_taut` text NOT NULL,
 `karte` text NOT NULL,
 `cikxcik` text NOT NULL,
 `id` int(10) NOT NULL auto_increment,
 PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=15

Link to comment
Share on other sites

<?php
if($_POST['dzest']){
$km2 = $_POST['clanwars'];
mysql_query("DELETE FROM cw WHERE km2 = '".$km2."'") or die(mysql_error());
}
?>
<form method="post">
<strong>Ko dzēst ?</strong><br>
 <select name="clanwars" size="1" >
   <option value="fnatic">1tm vs 2tm</option>
   <option value="sk">1tm vs 2tm</option>
 </select>
<input name="dzest" type="submit">
 </form>

Edited by false
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.

Guest
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.

Loading...
×
×
  • Create New...