Jump to content

Help with this function ... or EngInSite editor!


Johnain

Recommended Posts

I have got a function that the EnginSite Editor/Debugger is failing on a given line.

 

I cannot for the life of me work out why, and the debugger has decided that is not going to accept breakpoints today (no idea why, it did yesterday). It has also decided that it's too tired to evaluate statements or to give values on watchpoints, poor labm ! There is no help to be got at EngInSite, they are not answering e-mails at the support desk.

 

This is the function ....

 

function getgentext($textref, $langue, $text) {

// $textref is the reference of the text - NOT the row id in the table

// $sessionlangue is the language

// $text is to identify which text is returned

//    1 = long text

//    2 = medium text

//    3 = short text

//    4 = Column header text

 

 

$sql = "SELECT * FROM peri_othertexts where textref = $textref and langue = $langue ;

$result = mysql_query($sql) or die('SQL Query failed ... ' . mysql_error());     

$num_rows = mysql_num_rows($result);

$rowcontent = mysql_fetch_row($result)

 

switch($num_rows) {

  case 0 :

      switch($langue) {

        case 'FR' :

          $retval = 'Texte non disponible';

          break;

        case 'EN' :

          $retval = 'Text not available';

          break;

        default :

          $retval = 'Text not available';

      }       

  default:

    switch($text) {

      case 1:

        $retval =  $rowcontent['textlong'] ;

        break;

      case 2:

        $retval =  $rowcontent['textmed'] ;

        break;

      case 3:

        $retval =  $rowcontent['textshort'] ;

        break;

      case 4:

        $retval =  $rowcontent['textcolhead'] ;

        break;

      default:

        $retval =  $rowcontent['textlong'] ;

        break;

    }   

}     

 

return $retval ;

}

 

The highlighted line is the one that gets this message

 

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\htdocs\perigordirect\includes\db_lib.php on line 45

PHP Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\htdocs\perigordirect\includes\db_lib.php on line 45

 

But clearly there is a record found, or else it would have taken case 1 of the $num_rows switch.  I have checked and there is data there.

 

Cheers

 

John

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.