Results 1 to 3 of 3

Thread: [RESOLVED] Unexpected T_ELSE on line 42

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Resolved [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($result0); 
      
    $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: ?>

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width