Parse error: syntax error, unexpected '}' in /home/somesite/public_html/ssi/somepage.php on line 13
Here is the full php code for somepage.php.
<?php
$con = mysql_connect($location, $user, $pass) or die(mysql_error());
mysql_select_db($DB ,$con) or die(mysql_error());
?>
<?php
if (!isset($_POST['memID'])) //If not isset -> set with dummy value
{
$_POST['memID'] = "";
}
if(!isset($parentID))
{
$parentID = "";
}
$memID = $_POST['memID'];
if($memID != "") // Gets the User's Name if an ID is submitted.
{
$getMem = "SELECT * FROM mstmember WHERE memberCode = $memID";
$result = mysql_query($getMem, $con);
$Name = mysql_fetch_array($result);
$pID = $Name['id'];
$query = "SELECT * FROM mstmember WHERE parentid = $pID";
}
function getName() // Gets first level names
{
GLOBAL $query;
GLOBAL $con;
GLOBAL $memID;
$results = mysql_query($query, $con);
$tag = 1;
while($memID != "" && $Names = mysql_fetch_array($results))
{
echo "<div name='$tag'>"; // divs here belong to down class
echo $Names['firstName'] . " " . $Names['lastName'];
echo "</div>";
$tag++;
}
}
function getSecond() // gets second level
{
GLOBAL $memID;
GLOBAL $pID;
GLOBAL $con;
$query = "SELECT id FROM mstmember WHERE parentid = $pID"; //gets the IDs of the first downline
$results = mysql_query($query, $con);
while($memID != "" && $down1 = mysql_fetch_array($results))
{
echo "<div class='down2'>";
$parentID = $down1['id'];
$results2 = mysql_query("SELECT * FROM mstmember WHERE parentid = $parentID", $con);
while($down2 = mysql_fetch_array($results2))
{
echo "<div>" . $down2['firstName'] . " " . $down2['lastName'] . "</div> <br class='clrlft' />";
}
echo "</div>";
}
}
function getInfo()
{
GLOBAL $memID;
GLOBAL $Name;
echo "<h3>". $Name['firstName'] . " " . $Name['lastName'] ."</h1>";
if($memID != "") { echo "<p>About Member..</p>"; }
}
?>
<form action="genealogy.php" method="post">
<span>
<div class="searchgene">
<div>
<p>Enter your ID Number/Member Code: </p>
</div>
<div>
<input name="memID" type="text" value="" />
</div>
<div>
<input style="margin-top:3px;" type="submit" value="Submit" />
</div>
</div>
<div class="geneInfo">
<?php getInfo(); //Gets Member's info ?>
</div>
<hr style="border: 1px thin #000; width:80%; float: left; margin-left: 80px;" />
<br class="clearfloat" />
</span>
</form>
<center>
<div class="gene">
<?php echo $Name['firstName'] . " " . $Name['lastName']; ?>
</div>
<div class="down">
<?php getName(); ?>
</div>
<br class="clrlft" />
<?php getSecond(); ?>
<br class="clearfloat" />
</center>
Usual causes for this error (as far as I know) are missing brackets or using short open tags without it being enabled. But, I checked, I'm using full open tags on all php blocks and it's enabled on my php.ini file anyway. So that can't be it.
Also, if this is some bracket mishap. I cannot, for the life of me, see where it's missing.
HELP? =(
EDIT: I just tried this on another hosting site. The script works perfectly fine.
The support I'm getting from my current host is pretty bad as I don't think they know how to fix this, I can't blame them. I can't even figure it out.
Anyone here have any idea what could be causing this?
UPDATE:
This problem has been solved. See second post for details. Please keep the thread going as I'd like to hear some advices about PHP programming.
Thanks.
Edited by rgin, 08 November 2010 - 10:16 PM.