php phase error

Parse error: parse error in C:\wamp\www\asian\Connections\presalefromS2.php on line 57
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
//-->
</script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
 
<body>
<?

 if (isset($_POST['EnterBottom']))
             
{


mysql_select_db($database_aoldatabase, $aoldatabase); 
$query1 = "select max(refid) as maxref from presell";
$maxa = mysql_query ($query1)
    or die ("Query '$query' failed with error message: \"" . mysql_error () . '"');
$row = mysql_fetch_array($maxa);

$invoiceno = $row['maxref']+1;
echo "$invoiceno" ;
}

 
 
 ?>

<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" name="form1" id="form1" onsubmit="MM_validateForm('Productuserfill','','R','quantity','','NisNum');return document.MM_returnValue">
  <label>ProductCode</label>
    <input type="hidden" name="invoiceno" id="hiddenField" value='<?php 
	
	if (isset(!$invoiceno))
    {$invoiceno = 0 ; }

	
	
	echo $invoiceno;?>'/>
    <input type="text" name="Productuserfill" id="Productuserfill" />
  
  <span id="sprytextfield1">
  <label>No
    <input name="quantity" type="text" id="quantity" value="1" />
  </label>
  <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
  <label>
    Enter
      <input type="submit" name="EnterBottom" id="EnterBottom" value="Submit" accesskey="A" tabindex="E" />
  </label>
</form>

 <?php require_once('../Connections/aoldatabase.php'); 
$openaccount = 1 ;
session_start();

   

 <?php require_once('../Connections/aoldatabase.php'); 
 mysql_select_db($database_aoldatabase, $aoldatabase); 
 if (isset($_POST['EnterBottom']))

{
$invoiceno = $_POST['invoiceno'];          	
$AccNo = $_POST['Productuserfill'];
$quantity = $_POST['quantity'];
 


$query = "insert into presell (refid
 ,productcode,ProductName,qutiy
 ,price,datecreate,timestamp
)
select $invoiceno, product.ProductId, product.ProductName
    , if( ProductQuantity < $quantity, ProductQuantity, $quantity )
    , product.ProductPrice,Now(),Now()
from product  
where product.ProductId = '$AccNo'  
on duplicate key update  qutiy = qutiy + $quantity ";

 
 
// mysql_query ($query)
//    or die ("Query '$query' failed with error message: \"" . mysql_error () . '"');
 
 
 
$result = mysql_query ($query)
    or die ("Query '$query' failed with error message: \"" . mysql_error () . '"');

if ($result) {
        $openaccount = 1;
} 
 
 
 
 
 
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
 
$query_slelectPresell = "SELECT presell.refid, presell.productcode, presell.qutiy, presell.price,presell.qutiy*presell.price, presell.productname FROM presell where presell.refid = $invoiceno ORDER BY `presell`.`timestamp` ASC";
$slelectPresell = mysql_query($query_slelectPresell, $aoldatabase) or die(mysql_error());
$row_slelectPresell = mysql_fetch_assoc($slelectPresell);
$totalRows_slelectPresell = mysql_num_rows($slelectPresell);
?>
 </p>
 
 <table width="906" height="121" border="1">
   <tr>
     <td width="80" height="37"></td>
     <td width="136">CODE</td>
     <td width="108">NAME</td>
     <td width="108">Quantity</td>
     <td width="108">Uprice</td>
     <td width="160">Total</td>
     <td width="160">dd</td>
   </tr>
   <?php $totqutiy = 0  ;
   $toPay = 0  ;
   $noorder = 0  ;

  do { ?>
   <tr>
     <?php $totqutiy = $totqutiy+$row_slelectPresell['qutiy']  ;
	 $toPay = $toPay+$row_slelectPresell['presell.qutiy*presell.price']  ;
	 $noorder = $noorder + 1 ;
	 ?>
     <td height="32"><?php echo $noorder ; ?></td>
     <td><?php echo $row_slelectPresell['productcode']; ?></td>
     <td><?php echo $row_slelectPresell['productname']; ?></td>
     <td><?php echo $row_slelectPresell['qutiy']; ?></td>
     <td align="right"><?php echo  number_format($row_slelectPresell['price'], 2, '.', ','); ?></td>
     <td align="right"><?php echo  number_format($row_slelectPresell['presell.qutiy*presell.price'], 2, '.', ',');   $row_slelectPresell['presell.qutiy*presell.price']; ?></td>
     <td>delete</td>
   </tr>
   <?php } while ($row_slelectPresell = mysql_fetch_assoc($slelectPresell)); ?>
   <tr>
     <td width="80" height="42"></td>
     <td width="136">&nbsp;</td>
     <td width="108">&nbsp;</td>
     <td width="108"><?php echo $totqutiy; ?></td>
     <td width="108">&nbsp; </td>
     <td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',')  ; ?></td>
     <td width="160">&nbsp; </td>
   </tr>
 </table>
 <p>&nbsp; </p>
<p>  </p>
<p>  </p>
<script type="text/javascript">ololo
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "integer", {validateOn:["blur"]});
//-->
</script>
</body>
</html>
<?php
                mysql_free_result($slelectPresell);
}
  
?>

Open in new window

teeraAsked:
Who is Participating?
 
ludofulopConnect With a Mentor Commented:
@ line 57, there should be if (!isset($invoiceno))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.