Jump to content

Can someone see if this has any errors?


Dethman

Recommended Posts

if($_POST['defcon']){
$defcon=$_POST['defcon_rate'];
  $q=mysql_query("INSERT INTO `user_users` SET `alert`='$defcon' WHERE `userid`='$player['userid']'");
if( $q ){
	header("location: lair.php?strErr=You Have Upgraded Your Defcon Rate");
}
}

 

I think there may be something wrong with this can someone help?

 

Thanks,

Brian Flores AKA Dethman

Link to comment
https://forums.phpfreaks.com/topic/114002-can-someone-see-if-this-has-any-errors/
Share on other sites

Try this:

 

if(isset($_POST['defcon'])){
$defcon = $_POST['defcon_rate'];
$player = $player['userid'];
  $q = "UPDATE `user_users` SET `alert`='$defcon' WHERE `userid`='$player'";
  $result = mysql_query($q);
if($result){
	header("location: lair.php?strErr=You Have Upgraded Your Defcon Rate");
} else {
    echo "Error";
  }
}

 

Shimmy

SET is perfectly valid in an INSERT statement.

 

The big question here is, does it work? Your meant to tell us something isn't working, describing what you want it to do and what it actually does do, from there we attempt to help. Simply stating you 'think' something may be wrong gets us knowhere.

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.