Line 122 where it says <?php else:
I can't for the life of me figure out why I'm getting a parse error here. It doesn't give much information or I'd probably be able to figure it out.
Please reply if you see anything!!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- systemnew.php -->
<html>
<head>
<title>New System</title>
</head>
<body>
<h1>New System</h1>
<?php
$cnx = mysql_connect('000','000','000');
mysql_select_db('database');
?>
<?php if(isset($_POST['submit'])): // A new system has been entered
$system = $_POST['system'];
$ticker = $_POST['ticker'];
$aid = $_POST['author'];
$frequency = $_POST['frequency'];
$datapoints = $_POST['datapoints'];
$mincap = $_POST['mincap'];
$cagr = $_POST['cagr'];
$mar = $_POST['mar'];
$price = $_POST['price'];
$disclosed = $_POST['disclosed'];
$ptable = $_POST['ptable'];
$validated = $_POST['validated'];
$lastupdate = $_POST['lastupdate'];
$error = 0;
if($aid == '') {
echo("<p>You must choose an author.</p>");
$error = $error + 1;
}
else if($ticker == '') {
echo("<p>You must choose a ticker.</p>");
$error = $error + 1;
}
else if($system == '') {
echo("<p>You must choose a system name.</p>");
$error = $error + 1;
}
else if($frequency == '') {
echo("<p>You must enter a frequency.</p>");
$error = $error + 1;
}
else if($datapoints == '') {
echo("<p>You must enter number of backtest data points available.</p>");
$error = $error + 1;
}
else if($mincap == '') {
echo("<p>You must enter an capital assumption.</p>");
$error = $error + 1;
}
else if($lastupdate == '') {
echo("<p>You must enter a date in the format YYYY-MM-DD.</p>");
$error = $error + 1;
}
if($error >= '1') {
die("<p>There were $error errors. No changes made.</p>");
}
$sql = "INSERT INTO Sysems SET System = '$system', Ticker = '$ticker',
TimeFrame = '$timeframe', Frequency = '$frequency', DataPoints = '$datapoints',
MinCap = '$mincap', CAGR = '$cagr', MAR = '$mar', Price = '$price',
Disclosed = '$disclosed', PTable = '$ptable', Validated = '$validated',
LastUpdate = '$lastupdate'";
if(mysql_query($sql)) {
echo("<p>$system added to the database.</p>");
} else {
echo("<p>Problem adding $system to the database: " . mysql_error() . "</p>");
}
$sid = mysql_insert_id();
if($types = '') $types = array();
if($markets = '') $markets = array();
if($platforms = '') $platofrms = array();
$numtypes =0;
foreach($types as $typeID) {
$sql = "INSERT INTO SystemTypeLookup SID='$sid', TID='$typeID'";
if(mysql_query($sql)) {
$numtypes = $numtypes + 1;
echo("<p>$name added to $numtypes system types.</p>");
} else {
echo("<p><b>Error adding $name to system types.</b></p>");
}
$nummarkets =0;
foreach($markets as $marketID) {
$sql = "INSERT INTO MarkLookup SID='$sid', MTID='$marketID'";
if(mysql_query($sql)) {
$nummarkets = $nummarkets + 1;
echo("<p>$name added to $nummarkets markets.</p>");
} else {
echo("<p><b>Error adding $name to markets traded.</b></p>");
}
$numplatforms =0;
foreach($platforms as $platformID) {
$sql = "INSERT INTO PlatLookup SID='$sid', MTID='$platformID'";
if(mysql_query($sql)) {
$numplatforms = $numplatforms + 1;
echo("<p>$system added to $numplatforms platforms.</p>");
} else {
echo("<p><b>Error adding $system to platforms.</b></p>");
}
?>
<p><a href="<?=$_SERVER['PHP_SELF']?>"> Add another system.</a><br />
<a href="systems.php">Back to systems list.</a></p>
<?php else:
$types = mysql_query('SELECT ID, SysType FROM SystemTypes');
$markets = mysql_query('SELECT ID, Name FROM Markets');
$platforms = mysql_query('SELECT ID, Name FROM Platforms');
?>
<form action="<?=$_SERVER['PHP_SELF']?>"> method="post">
<p>System Name: <input type="text" name="system" /><br />
Ticker: <input type="text" name="ticker" /><br />
Author: <select name="author" size="1">
<option selected value="">Select</option>
<?php
while($author = mysql_fetch_array($authors)) {
$id = $author['ID'];
$name = $author['Name'];
echo("<option value=$id>$name</option>\n");
}
?>
</select> <br />
System trades these markets:<br />
<?php
while($market = mysql_fetch_array($markets)) {
$mid = $market['ID'];
$mname = $market['Name'];
echo("<input type='checkbox' name='markets[]' value='$mid' />" .
"$mname<br />\n");
}
?>
<br />
System is:<br />
<?php
while($type = mysql_fetch_array($types)) {
$tid = $type['ID'];
$tname = $type['SysType'];
echo("<input type='checkbox' name='types[]' value='$tid' />" .
"$tname<br />\n");
}
?>
<br />
Signals generated by (select as many as code is available):<br />
<?php
while($platform = mysql_fetch_array($platforms)) {
$pid = $platform['ID'];
$pname = $platform['Name'];
echo("<input type='checkbox' name='platforms[]' value='$pid' />" .
"$pname<br />\n");
}
?>
<br />
TimeFrame: <input type="text" name="timeframe" /><br />
Frequency: <input type="text" name="frequency" /><br />
DataPoints: <input type="text" name="datapoints" /><br />
MinCap: <input type="text" name="mincap" /><br />
CAGR: <input type="text" name="cagr" /><br />
MAR: <input type="text" name="mar" /><br />
Price: <input type="text" name="price" /><br />
Disclosed? <select name="disclosed" size="1">
<option selected value="0">No</option>
<option value="1">Yes</option></select> <br />
Performance Available? <select name="ptable" size="1">
<option selected value="0">No</option>
<option value="1">Yes</option></select> <br />
Validated? <select name="validated" size="1">
<option selected value="0">No</option>
<option value="1">Yes</option></select> <br />
Updated YYYY-MM-DD: <input type="text" name="date"> <br />
</form>
<?php endif; ?>
</body>
</html>