Ibshas25 Posted November 2, 2010 Share Posted November 2, 2010 not sure on this one... seems like somethings missing try { $st = $conn->prepare( $sql ); $st->bindValue( ":username", $this->data["username"], PDO::PARAM_STR ); $st->bindValue( ":firstname", $this->data["firstName"], PDO::PARAM_STR ); $st->bindValue( ":lastName", $this->data["lastName"], PDO::PARAM_STR ); $st->bindValue( ":password", $this->data["password"], PDO::PARAM_STR ); $st->bindValue( ":joinTime", $this->data["joinTime"], PDO::PARAM_STR ); PDO::PARAM_STR ); $st->execute(); parent::disconnect( $conn ); } catch ( PDOException $e ) { parent::disconnect( $conn ); die( "Query failed: " . $e->getMessage() ); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/ Share on other sites More sharing options...
doddsey_65 Posted November 2, 2010 Share Posted November 2, 2010 PDO::PARAM_STR ); that bracket shouldnt be there im thinking, but without a look at the full code i cant be sure Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/#findComment-1129387 Share on other sites More sharing options...
Ibshas25 Posted November 2, 2010 Author Share Posted November 2, 2010 <?php require_once "DataObject.class.php"; class users extends DataObject { protected $data = array( "usr_id" => "", "usr_username" => "", "usr_name" => "", "usr_surname" => "", "usr_password" => "", "usr_issysadmin" => "", "usr_isuseractive" => "", "usr_lastlogintime" => "", "usr_recorduserid" => "", "usr_recordtime" => "", ); 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::discount( $conn ); die( "Query Failed: " . $e->getMessage() ); } } public static function getBYUsername( $username ) { $conn = parent::connect(); $sql = " SELECT * FROM " . TBL_users . "WHERE usr_username = :username"; try { $st = $conn->prepare( $sql ); $st->bindValue( ":username", $username, PDO::PARAM_STR ); $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() ); } } public function insert() { $conn = parent::connect(); $sql = "INSERT INTO " .TBL_users . " ( usr_username, usr_name, usr_surname, usr_password, usr_recordtime ) Values ( :username, :firstname, :lastName, password(:password), :joinTime )"; try { $st = $conn->prepare( $sql ); $st->bindValue( ":username", $this->data["username"], PDO::PARAM_STR ); $st->bindValue( ":firstname", $this->data["firstName"], PDO::PARAM_STR ); $st->bindValue( ":lastName", $this->data["lastName"], PDO::PARAM_STR ); $st->bindValue( ":password", $this->data["password"], PDO::PARAM_STR ); $st->bindValue( ":joinTime", $this->data["joinTime"], PDO::PARAM_STR ); PDO::PARAM_STR ); $st->execute(); parent::disconnect( $conn ); } catch ( PDOException $e ) { parent::disconnect( $conn ); die( "Query failed: " . $e->getMessage() ); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/#findComment-1129392 Share on other sites More sharing options...
revraz Posted November 2, 2010 Share Posted November 2, 2010 Sure helps if you say what line number the error is on, and point it out in the code. Did you at least try to remove that ")" mentioned above? Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/#findComment-1129399 Share on other sites More sharing options...
Ibshas25 Posted November 2, 2010 Author Share Posted November 2, 2010 it was giving the error at line 108 at the start of PDO::PARAM_STR ; $st->execute(); parent::disconnect( $conn ); } catch ( PDOException $e ) { parent::disconnect( $conn ); die( "Query failed: " . $e->getMessage() ); } } i took that bracket out but now its gives this Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /export/SOI-50/students/m2009/abhr428/web/WebIbs/users.class.php on line 120 Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/#findComment-1129405 Share on other sites More sharing options...
kenrbnsn Posted November 2, 2010 Share Posted November 2, 2010 This line <?php PDO::PARAM_STR ; ?> probably shouldn't even be in the code. Ken Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/#findComment-1129488 Share on other sites More sharing options...
Ibshas25 Posted November 2, 2010 Author Share Posted November 2, 2010 whys that ken?? Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/#findComment-1129493 Share on other sites More sharing options...
kenrbnsn Posted November 2, 2010 Share Posted November 2, 2010 It's not a valid PHP statement. Comment it out and see if your code works. Ken Quote Link to comment https://forums.phpfreaks.com/topic/217556-parse-error-syntax-error-unexpected-in-expor/#findComment-1129502 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.