[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

php phase error

Posted on 2009-12-29
1
Medium Priority
?
317 Views
Last Modified: 2012-06-27
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

0
Comment
Question by:teera
1 Comment
 
LVL 15

Accepted Solution

by:
ludofulop earned 2000 total points
ID: 26136605
@ line 57, there should be if (!isset($invoiceno))
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month17 days, 16 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question