[RESOLVED] Unexpected T_ELSE on line 42
Further to my thread here: http://www.vbforums.com/showthread.php?t=398545
I have inserted the following code and I am getting an error. What am I doing wrong? Totally a newb to PHP and would love to learn this language.
PHP Code:
<?php if ($clientVersionString = $currentVersionString) ?>
<table><tr>
<td>You currently have the current version installed on your computer.</td>
</tr>
<?php else: ?>
<tr>
<td>A new version is available for download. Please login to your BrailleSchool account to download the new version.<br><br>
To upgrade to the new version, UNINSTALL your current version before installing the new version. If you are upgrading to a completely new version, for example, from 1.x.x to 2.x.x then there is an upgrade price of $4.99 applicable before a new licence will be issued.<br><br>
<b>To uninstall:</b><br>
Click START-> CONTROL PANEL. Double click Add/Remove Programs. Find Braille Reference Guide and REMOVE it. Do NOT "repair" or "change".<br><br>
Then download the new version and install it. If you are prompted to REPAIR or REMOVE instead of install. You should select REMOVE and then download the file again and install it.</td>
</tr></table>
<?php endif; ?>
The complete code is as follows:
PHP Code:
<?php
include("config.php");
$connection = mysql_connect($server, $brlqrg_un, $brlqrg_pw);
mysql_select_db($brlqrf_db, $connection);
$query = "SELECT CurrVer FROM CurrentVersion";
$clientVersionString = $_GET['Version'];
$result = @mysql_query($query, $connection);
if (is_resource($result)) {
$currentVersionString = mysql_result($result, 0);
$majorDiff = $currentVersionString[0] - $clientVersionString[0];
$minorDiff = $currentVersionString[1] - $clientVersionString[1];
$revisionDiff = $currentVersionString[2] - $clientVersionString[2];
}
?><table>
<?php if (is_resource($result)): ?>
<tr>
<td><b>Current Version:</b></td>
<td><?=$currentVersionString?></td>
</tr>
<tr>
<td><b>Installed Version:</b></td>
<td><?=$clientVersionString?></td>
</tr>
<tr>
<td colspan="2">You are <b><?=$majorDiff?>.<?=$minorDiff?>.<?=$revisionDiff?> versions out of date.</td>
</tr>
<?php else: ?>
<tr>
<td><b>Unable to retrieve the current version</b></td>
</tr>
<?php endif; ?>
</table>
<?php if ($clientVersionString = $currentVersionString) ?>
<table><tr>
<td>You currently have the current version installed on your computer.</td>
</tr>
<?php else: ?>
<tr>
<td>A new version is available for download. Please login to your BrailleSchool account to download the new version.<br><br>
To upgrade to the new version, UNINSTALL your current version before installing the new version. If you are upgrading to a completely new version, for example, from 1.x.x to 2.x.x then there is an upgrade price of $4.99 applicable before a new licence will be issued.<br><br>
<b>To uninstall:</b><br>
Click START-> CONTROL PANEL. Double click Add/Remove Programs. Find PDF to DOC and REMOVE it. Do NOT "repair" or "change".<br><br>
Then download the new version and install it. If you are prompted to REPAIR or REMOVE instead of install. You should select REMOVE and then download the file again and install it.</td>
</tr></table>
<?php endif; ?>
Line 42 is the following (<?php else: ?>)
PHP Code:
<?php if ($clientVersionString = $currentVersionString) ?>
<table><tr>
<td>You currently have the current version installed on your computer.</td>
</tr>
<?php else: ?>
Re: Unexpected T_ELSE on line 42
You left off a colon:
Code:
<?php if ($clientVersionString == $currentVersionString): ?>
You might also want to use the equality operator == instead of the assignment operator =, which assigns the value of $currrentVersionString to $clientVersionString.
Re: Unexpected T_ELSE on line 42
Quote:
Originally Posted by visualAd
You left off a colon:
Code:
<?php if ($clientVersionString == $currentVersionString): ?>
You might also want to use the equality operator == instead of the assignment operator =, which assigns the value of $currrentVersionString to $clientVersionString.
Thanks visualAd, it's now working.