Jump to content

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /


Recommended Posts

 

not sure what the error is 

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /export/SOI-50/students/m2009/abhr428/web/WebIbs/User.class.php on line 59

 

 

 

 

<?php

require_once "DataObject.class.php";

class user extends DataObject {

  protected $data = array(
    "usr_id" => "",
    "usr_username" => "",
    "usr_password" => "",
    "usr_name" => "",
    "lastName" => "",
    "jointime" => ""
);

  

  public static function getUsers( $startRow, $numRows, $order ) {
    $conn = parent::connect();
    $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM " . TBL_USERS . " ORDER BY $order LIMIT :startRow, :numRows";

    try {
      $st = $conn->prepare( $sql );
      $st->bindValue( ":startRow", $startRow, PDO::PARAM_INT );
      $st->bindValue( ":numRows", $numRows, PDO::PARAM_INT );
      $st->execute();
      $users = array();
      foreach ( $st->fetchAll() as $row ) {
        $users[] = new user( $row );
      }
      $st = $conn->query( "SELECT found_rows() AS totalRows" );
      $row = $st->fetch();
      parent::disconnect( $conn );
      return array( $users, $row["totalRows"] );
    } catch ( PDOException $e ) {
      parent::disconnect( $conn );
      die( "Query failed: " . $e->getMessage() );
    }
  }

  public static function getUser( $id ) {
    $conn = parent::connect();
    $sql = "SELECT * FROM " . TBL_USERS . " WHERE usr_id = :id";

    try {
      $st = $conn->prepare( $sql );
      $st->bindValue( ":id", $id, PDO::PARAM_INT );
      $st->execute();
      $row = $st->fetch();
      parent::disconnect( $conn );
      if ( $row ) return new User( $row );
    } catch ( PDOException $e ) {
      parent::disconnect( $conn );
      die( "Query failed: " . $e->getMessage() );
    }
  }


?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.