compare values


the script below is part of a form which inserts the form values into mysql and works fine, however i am trying to get it to compare 2 values from the form and based on the outcome add a certain value to database

This what i’m trying to do if homescore > awayscore then the value inserted into points should be 3


if ((isset($_POST[“MM_insert”])) && ($_POST[“MM_insert”] == “form2”)) {
$insertSQL = sprintf(“INSERT INTO latestscore (hometeam, awayteam, homescore, awayscore, points) VALUES (%s, %s, %s, %s, %s)on duplicate key update homescore= VALUES (homescore), awayscore = values(awayscore), points =values(points)”,
GetSQLValueString($_POST[‘HOMETEAM’], “text”),
GetSQLValueString($_POST[‘AWAYTEAM’], “text”),
GetSQLValueString($_POST[‘HOMESCORE’], “int”),
GetSQLValueString($_POST[‘AWAYSCORE’], “int”),
GetSQLValueString($_POST[‘points’], “int”));

mysql_select_db($database_dwsearch, $dwsearch);
$Result1 = mysql_query($insertSQL, $dwsearch) or die(mysql_error());

Sponsor our Newsletter | Privacy Policy | Terms of Service