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
https://forums.phpfreaks.com/topic/268438-need-help-to-solve-this/
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

Archived

This topic is now archived and is closed to further replies.

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