View Single Post
  #1  
Old 02-06-2002, 09:06 AM
Lesane's Avatar
Lesane Lesane is offline
 
Join Date: Oct 2001
Location: The Netherlands
Posts: 1,149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i'm going crazy

i'm using the following code:

PHP Code:
<?php

include("config.php");

if (isset(
$submitok)) {


if (
$delete) { 
foreach(
$delete as $val) {
$query "DELETE FROM award WHERE aw='$uid'"
$result mysql_query($query) or die("SELECT Error: " mysql_error() . " in Query: $miet"); 
 }
if(
$result) {
print (
"deleted");
} else {
print (
"not gedeleted");
}
}


    foreach(
$aw as $val) {
    
$lala="UPDATE award SET aw='$val' WHERE awardsid='$val[awardsid]'";
    
$result mysql_query($lala) or die("SELECT Error: " mysql_error() . " in Query: $query");
       }
if(
$result) {
print (
"updated");
} else {
print (
"not updated");
}

    }

else {


?>


<center>
<h3>Awards
<hr width="75%" color="#00AAFF">
</h3>
</center><br>
<form action="<?PHP $PHP_SELF ?>">
<table width="100%" cellspacing="0" cellpadding="5" border="1">
 <tr>
  <td>Awardsname</td>
  <td>Button</td>
 
 </tr> 

<?php

include("config.php");

$result mysql_query("SELECT aw,awardsid,name, url FROM award");
         while (
$award mysql_fetch_array($result)) {
         
$lesane=$award[aw];
          if(
$lesane == "$award[awardsid]") {         
         
$lala="checked";
         } else {
         
$lala="";
         }
         
       echo 
"<tr><td><input type='checkbox' name='aw[$award[awardsid]]' value='$award[awardsid]'";
          if (
$aw) {
          echo 
"selected $lala>$award[name]</td><td nowrap>";
          } else {
          echo 
$lala>$award[name]</td><td nowrap>";
          }
       echo 
"<img src=\"$award[url]\">&nbsp;&nbsp;&nbsp;</td>";
     
     if(!
$award[aw]) {
     
$uid="aw[$award[awardsid]]";
     } else {
     
$uid=""
     }
     } 
 echo 
"<br><tr><td colspan=2 align=center>";
 echo 
"<br><input type='hidden' name='delete[]' value='$uid'>";
echo 
"<br><br><input type='submit' name='submitok' value='Submit'>";
echo 
"</td></tr></table></form>";

    }
?>
I have currently 2 awards in the database

1. Awards name with the awardsid 9 and aw is also 9
2. Lesane with the awardsid 13 and aw is empty (means not checked)

So when i execute the script then i c awards name selected and lesane is not selected and if i check the code by <input type =hidden then i c:

<input type='hidden' name='delete[]' value='aw[13]'>

so thats right, lesane is not selected and have the id 13.

Now i'm totally confused because when i click on submit then it deletes lesane totally and when i uncheck the award with the name "awards name" then that aw is not gonna deleted because only the input type = hidden was lesane

So my questions are:

Whats the delete query to delete only the aw row from awards where awardsid=?
&
How is it possible to delete the aw row from the award called "Awards Name" when i uncheck him?


I hope u have a solution
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01290 seconds
  • Memory Usage 1,805KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete