smarlar
08-15-2006, 05:38 PM
I have missed a closing statement somewhere and cannot figure it out.
This page is simply listing data and inputting a quantity filed to update.
The error is "Parse error: parse error, unexpected $ in /home/trailerr/public_html/UpdateQnty3.php on line 168"
Line 168 is the closing html statement" </html>".
<?php
require_once('init.php');
require_once('settings.inc');
if (isset($_POST['Update'])){
if ($_POST['Update']=="Home") header('Location: CustomerSearch.php');
if ($_POST['Update']=="Save") {
$link = mysql_connect($hostname, $login, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$cid=0;
$type="TL";
foreach ($_POST["Qnty"] as $value) {
if ($cid>=$_POST["RN"]) $type="TT";
mysql_select_db($dbname);
if ($type=="TL") {
$result = mysql_query('
SELECT * from trailertype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE trailertype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}
else
{
$result = mysql_query('
SELECT * from tractortype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE tractortype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="griffin.css" type="text/css">
<title>Update Quantity</title>
</head>
<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>
<?php
include ('logo_header.php');
?>
<table border=0 width=800><tr><td>
<form name=UpdateQnty action="UpdateQnty.php" method=post>
<a class=titler>Update Quantity </a> as of <?php echo date("F d, Y"); ?>
</td></tr></table><br>
<table border=0 width=800 align=center bgcolor=#000000 cellpadding=0 cellspacing=0><tr ><td>
<table border=0 width=100% align=center cellpadding=3 cellspacing=1><tr bgcolor=cdcdcd align=center >
<td><b>Ref. No. </b></td>
<td width=60><b> Available Date </b></td>
<td><b> Year </b></td>
<td><b> Equipment Type </b></td>
<td><b> Qty Update</b></td>
<td width= 100><b> Company </b></td>
<td><b>Status Date</b></td></tr>
<?php
mysql_select_db($dbname);
$result = mysql_query('
SELECT * from trailertype tl, customerinfo c
WHERE tl.RefNo=c.RefNo and tl.status="Sell" '.$wh)
or die("Query failed : " . mysql_error());
$TL=mysql_num_rows($result);
$TLNum=$TL;
$TLa=array($TLNum);
while ($row = mysql_fetch_assoc($result))
{
$TLa[$row['ID']]=$row['SELL_STATUS'];
echo "<tr bgcolor=white>
<td> TL$row[ID]
<input type=hidden name=rid[] value=$row[ID]>
<input type=hidden name=RN value=$TL>
</td>
<td>".date("F",mktime(0,0,0,$row['aMonth'],1,2005))." ".$row['aYear']."</td>
<td> $row[Year] </td>
<td> $row[TL] <input type=hidden name=EQ value=TL></td>
<td> <input type=text name=Qnty[] size=1 value=".$row['Quantity']." class=TxtBut></td>
<td> $row[Company] </td>
<td>".strftime("%m/%d/%y",strtotime("$row[Status_Date]"))." </td>
</tr>";
}
$result = mysql_query('
SELECT * from tractortype tt, customerinfo c
WHERE tt.RefNo=c.RefNo and tt.status="Sell" '.$wh)
or die("Query failed : " . mysql_error());
$TTNum=mysql_num_rows($result);
$TTa=array($TTNum);
while ($row = mysql_fetch_assoc($result))
{
$TTa[$row['ID']]=$row['SELL_STATUS'];
echo "<tr bgcolor=white>
<td> TT$row[ID] <input type=hidden name=rid[] value=$row[ID]></td>
<td>".date("F",mktime(0,0,0,$row['aMonth'],1,2005))." ".$row['aYear']."</td>
<td> $row[Year] </td>
<td> $row[TT] <input type=hidden name=EQ value=TT></td>
<td> <input type=text name=Qnty[] size=1 value=".$row['Quantity']." class=TxtBut></td>
<td> $row[Company] </td>
<td>".strftime("%m/%d/%y",strtotime("$row[Status_Date]"))." </td>
</tr>";
}
?>
</table>
</td></tr></table>
<center><br>
<input type=button name="Update" value="Print" class=TxtBut onClick="window.print()">
<input type=submit name="Update" value="Save" class=TxtBut>
<input type=submit name="Update" value="Home" class=TxtBut>
</form>
<br></center>
<?php include ('logo_footer.php');?>
</body>
</html>
I have narrowed it down to the following section but, can't figure it out.
$cid=0;
$type="TL";
foreach ($_POST["Qnty"] as $value) {
if ($cid>=$_POST["RN"]) $type="TT";
mysql_select_db($dbname);
if ($type=="TL") {
$result = mysql_query('
SELECT * from trailertype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE trailertype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}
else
{
$result = mysql_query('
SELECT * from tractortype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE tractortype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}
This page is simply listing data and inputting a quantity filed to update.
The error is "Parse error: parse error, unexpected $ in /home/trailerr/public_html/UpdateQnty3.php on line 168"
Line 168 is the closing html statement" </html>".
<?php
require_once('init.php');
require_once('settings.inc');
if (isset($_POST['Update'])){
if ($_POST['Update']=="Home") header('Location: CustomerSearch.php');
if ($_POST['Update']=="Save") {
$link = mysql_connect($hostname, $login, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$cid=0;
$type="TL";
foreach ($_POST["Qnty"] as $value) {
if ($cid>=$_POST["RN"]) $type="TT";
mysql_select_db($dbname);
if ($type=="TL") {
$result = mysql_query('
SELECT * from trailertype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE trailertype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}
else
{
$result = mysql_query('
SELECT * from tractortype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE tractortype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="griffin.css" type="text/css">
<title>Update Quantity</title>
</head>
<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>
<?php
include ('logo_header.php');
?>
<table border=0 width=800><tr><td>
<form name=UpdateQnty action="UpdateQnty.php" method=post>
<a class=titler>Update Quantity </a> as of <?php echo date("F d, Y"); ?>
</td></tr></table><br>
<table border=0 width=800 align=center bgcolor=#000000 cellpadding=0 cellspacing=0><tr ><td>
<table border=0 width=100% align=center cellpadding=3 cellspacing=1><tr bgcolor=cdcdcd align=center >
<td><b>Ref. No. </b></td>
<td width=60><b> Available Date </b></td>
<td><b> Year </b></td>
<td><b> Equipment Type </b></td>
<td><b> Qty Update</b></td>
<td width= 100><b> Company </b></td>
<td><b>Status Date</b></td></tr>
<?php
mysql_select_db($dbname);
$result = mysql_query('
SELECT * from trailertype tl, customerinfo c
WHERE tl.RefNo=c.RefNo and tl.status="Sell" '.$wh)
or die("Query failed : " . mysql_error());
$TL=mysql_num_rows($result);
$TLNum=$TL;
$TLa=array($TLNum);
while ($row = mysql_fetch_assoc($result))
{
$TLa[$row['ID']]=$row['SELL_STATUS'];
echo "<tr bgcolor=white>
<td> TL$row[ID]
<input type=hidden name=rid[] value=$row[ID]>
<input type=hidden name=RN value=$TL>
</td>
<td>".date("F",mktime(0,0,0,$row['aMonth'],1,2005))." ".$row['aYear']."</td>
<td> $row[Year] </td>
<td> $row[TL] <input type=hidden name=EQ value=TL></td>
<td> <input type=text name=Qnty[] size=1 value=".$row['Quantity']." class=TxtBut></td>
<td> $row[Company] </td>
<td>".strftime("%m/%d/%y",strtotime("$row[Status_Date]"))." </td>
</tr>";
}
$result = mysql_query('
SELECT * from tractortype tt, customerinfo c
WHERE tt.RefNo=c.RefNo and tt.status="Sell" '.$wh)
or die("Query failed : " . mysql_error());
$TTNum=mysql_num_rows($result);
$TTa=array($TTNum);
while ($row = mysql_fetch_assoc($result))
{
$TTa[$row['ID']]=$row['SELL_STATUS'];
echo "<tr bgcolor=white>
<td> TT$row[ID] <input type=hidden name=rid[] value=$row[ID]></td>
<td>".date("F",mktime(0,0,0,$row['aMonth'],1,2005))." ".$row['aYear']."</td>
<td> $row[Year] </td>
<td> $row[TT] <input type=hidden name=EQ value=TT></td>
<td> <input type=text name=Qnty[] size=1 value=".$row['Quantity']." class=TxtBut></td>
<td> $row[Company] </td>
<td>".strftime("%m/%d/%y",strtotime("$row[Status_Date]"))." </td>
</tr>";
}
?>
</table>
</td></tr></table>
<center><br>
<input type=button name="Update" value="Print" class=TxtBut onClick="window.print()">
<input type=submit name="Update" value="Save" class=TxtBut>
<input type=submit name="Update" value="Home" class=TxtBut>
</form>
<br></center>
<?php include ('logo_footer.php');?>
</body>
</html>
I have narrowed it down to the following section but, can't figure it out.
$cid=0;
$type="TL";
foreach ($_POST["Qnty"] as $value) {
if ($cid>=$_POST["RN"]) $type="TT";
mysql_select_db($dbname);
if ($type=="TL") {
$result = mysql_query('
SELECT * from trailertype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE trailertype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}
else
{
$result = mysql_query('
SELECT * from tractortype WHERE ID='.$_POST["rid"][$cid]
) or die("Query failed : " . mysql_error());
while ($row = mysql_fetch_assoc($result));
mysql_query("UPDATE tractortype
SET
Qnty='".$_POST["Qnty"][$cid]."'
WHERE ID=".$_POST["rid"][$cid])
or die("Query failed : " . mysql_error());
}