Jump to content

need help to solve this!


jac.kock

Recommended Posts

hi all,

 

i want to run in my cms a script that can set up or remove a user_block.

what i have so var will set 1 tot the database but i cant seem to return it to 0,

so i hope that someone will help me to solve it!

 

code so var:

// this function is called in a form with while(ect....) <checkbox id='[b]' value='$user_id'> for more than one user

//set blokkeren
function set_blok($blk)
{
foreach($blk as $var)
{
	if($blk[$a]=='') { $set='0'; } else { $set='1'; } //this i tryed to see if it needs to be 0 or 1

	$sql="update users set blokkeren='$set' where user_id='$var'";
	$res=mysql_query($sql);
}

if(!$res)
{
	return false;
}
else
{
	return true;
}
}

Link to comment
Share on other sites

hi,

 

$a was for a test i did i used it like:


function set_blok($blk)
{
 foreach($blk as $var;$a=$a++)
 {
	 if($blk[$a]=='') { $set='0'; } else { $set='1'; } //this i tryed to see if it needs to be 0 or 1

	 $sql="update users set blokkeren='$set' where user_id='$var'";
	 $res=mysql_query($sql);
 }

 if(!$res)
 {
	 return false;
 }
 else
 {
	 return true;
 }
}

 

i tryed to get each $blk array :(

 

i want when i uncheck the box that it set it to 0 en by checked to 1 :)

 

can you help me?

 

thnx

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.