can any1 help with this php/sql updateing script

02/14/2011 05:42 ac1dtab#1
edited to fixed the verification thanks to tylor but now it verafys the points above 3 if you have 0 points and input 2 to deduct it and it still deducts the 2 from account leaveing a negative number in point field.. any idea how ta fix that part?? BTW this script now works with the edited Red wrighting also need the corect sql quary and the index page if any are interested in them just let me know ill post them.
Code:
<?php
$UserID = trim($_POST['UserID']);
$Points = trim ($_POST['Points']);

// Connection with MSSQL server

$conn=mssql_connect('Server','ServerID','ServerPass');
$db = mssql_select_db('PS_UserData',$conn) or die("MSSQL Conection Error!");
		$res = mssql_query("SELECT Point FROM  PS_UserData.dbo.Users_Master WHERE (UserID) = ('".$UserID."')"); 
		if ("[COLOR="Red"]$res[/COLOR]" < $Points)
		{
			echo "<b>Not enufe DP to Prosead</b><br>";
			}
			else
		{	
		$res1 = mssql_query("SELECT UserID FROM  PS_UserData.dbo.Users_Master WHERE (UserID) = ('".$UserID."')"); 
	
		if (mssql_num_rows($res1)) 
	{
				// Insert Start
					$query1 = "exec PS_GMTool.dbo.usp_DeleatePoints '".$UserID."','".$Points."'";
			$rresult1 = mssql_query($query1) or die("account dose not exist");
					{
							echo "<b>Successfully deleated  $Points Donation Points From $UserID account</b><br>";
					}
	}
else
	{
	echo '<b>Account dosent exist.</b>'; 
	}
	}
?>

i am not shure what i did wrong on the verafying that points in db is not less then points deducted when quary executes i got it ta makeshure account exists but cant get the point verification part to work can any1 plzz tell me were and what to add TY in advance