1 Replies - 291 Views - Last Post: 23 June 2012 - 12:35 PM Rate Topic: -----

#1 erburrell  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 145
  • Joined: 22-December 09

Function call causes screen to go blank.

Posted 23 June 2012 - 11:57 AM

Ok guys, this one has me stumped! I am trying to create a Member class and I am currently working on the register function. In the function, if I call the checkForMember function, I get a white screen on the browser. I am using a Mac, php 5.3.?, MySQL and using Firefox as the browser.

Ok, here is my code:

The index.php page:
<?php

    include_once('library/connection.php');
    
    if ($_GET['node']) {
        $data = $mysqli->query('SELECT * FROM nodes WHERE id=' . $_GET['node']);
    } else {
        $data = $mysqli->query('SELECT * FROM nodes WHERE id=1');
    }
    //echo $data;
    if (!$data) { 
        echo "Data retrieval failed: ";// . mysql_error();
    } else {
        $data->data_seek(0);
        $row = $data->fetch_assoc();

        $pageText = file_get_contents($row['base_file']);
        
        $title = $row['title'];
        $cssName = $row['css_file'];
        $content = $row['content'];
		
		$displayText = str_replace('{pTopLogin}', file_get_contents('templates/lineStyleLoginForm.html'), $pageText);
		$displayText = str_replace('{pAction}', 'index.php', $displayText);
        $displayText = str_replace('{pTitle}', $title, $displayText);
        $displayText = str_replace('{pCssRef}', $cssName, $displayText);
        $displayText = str_replace('{pContent}', $content, $displayText);
    	
		$data = NULL;
		include_once('library/member.php');
		try {
			$displayText .= '</br></br>' . Member::register("admin","asdfghjkl","bob@bob.com");
		} catch (Exception $ex) {
			$displayText .= '</br></br>' . $ex->__toString();
		}
		
        echo $displayText;
        
    }
?>


and the Member Class Code.
<?php
   /**
    *   @page The Member class (Extends DataObject).  The class provides all 
    *   interface to the database with regards to the member table.  It is 
    *   responsible for registering members and retreiving member data.
    */

   /**
    *   Require_once for database.php so that it is available for the class to extend.
    */
    require_once("database.php");

   /**
    *   The Member class.
    */
    class Member extends DataObject {
      /**
	   *	Member's username.
	   *	@var string
	   */
	   private $_username;
	   
	  /**
	   *	Member's e-mail address.
	   *	@var string
	   */
	   private $_email;
	  
	  /**
	   *	Member's validation status.
	   *	@var Boolean
	   */
	   private $_isValidated;
	  
	  /**
        *   __construct method for the member class.
        */   
        function __construct($username, $email, $validated ) {
            parent::__construct();
            if ($this->error) {
                return NULL;
            }
			/*
			$this->_username 	= $username;
			$this->_email 		= $email;
			$this->_isValidated	= $validated;
        	*/
		}

        /**
        *   Implementation of the abstract create function that is required by the parent.  This 
		*	function is static and should be used to create all Member instances.
		*
		*	@param $paramArray Array This array should contain the three (3) elements.  These 
		*	elements are the username, email and validated as a key => value paired array.
        */
        public static function create($paramArray) {
            /*if ( array_key_exists( 'username', $paramArray ) &&
				 array_key_exists( 'email', $paramArray ) &&
				 array_key_exists( 'validated', $paramArray ) ) {
			
					return new Member( $paramArray['username'], $paramArray['email'], $paramArray['validated']);
				 }*/
        }

	   /**
	    *	This method registers a new member in the database
		*	
		*	@param $username string The requested username.
		*	@param $password string The user selected password
		*	@param $email
		*/
		public static function register($username, $password, $email) {
			$memberInfo = array( 'username' => $username, 'email' => $email, 'validated' => FALSE);
			$newMember = new Member( $paramArray['username'], $paramArray['email'], $paramArray['validated']);
			//create($memberInfo);
			//checkForMember("BILL");
		}
		

       /**
        *   Abstract Function to require all child objects to provide an interface for
        *   setting the table name.
        */
        public function setTable( $tableName) {
            $this->dataTable = $tableName;
        }
        
        public function getData( $queryString ) {
            //To Do
        }
       
        public function insert( $dataList ) {
            //To Do
        }

        public function update( $dataRow ) {
            //To Do
        }

        public function delete( $id ) {
            //To Do
        }
		
		private function checkForMember( $username ) {
			//if ( $this->conn ) {
				//$res = $conn->query("SELECT id FROM " . DB_MEMBER_TABLE . " WHERE username = " . $username);
				/*if ($res) {
					return TRUE;
				} else {*/
					//return FALSE;
				/*}*/
			//}
		}
    }
?>


notice that the function checkForMember has everything inside of it commented out. I tried commenting out a bit at a time, and finally just mate it a blank function to try to figure out what was going on, and I still get a beautiful white browser window.

Any help is greatly appreciated.

Thanks,

Ed.

Is This A Good Question/Topic? 0
  • +

Replies To: Function call causes screen to go blank.

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5666
  • View blog
  • Posts: 22,509
  • Joined: 23-August 08

Re: Function call causes screen to go blank.

Posted 23 June 2012 - 12:35 PM

Blank screen == syntax error. Turn up your error messages or look in your error logs.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1