View Single Post
Old 02-20-2013, 08:31 AM   PM User | #1
danh2
New to the CF scene

 
Join Date: Feb 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
danh2 is an unknown quantity at this point
Retrieve value from database (got the data with extra spaces)

Hello i am having some issues,

when i try to pull some values from my db i get them with extra spaces like "DATA "

the code i am using for it is
Code:
		function doQuery($query)
		{
			$parameters = func_get_args();
			array_shift($parameters);

			$this->queryResult = $this->_doQuery($query, $parameters);
			if ($this->queryResult == -1)
				$this->getError();
			else
				parent::Success();


			return $this->queryResult;
		}
		
		function _doQuery($query, $parameters)
		{
			if (!parent::isConnected())
			{
				if (!$this->doConnect())
					return -1;
			}
			
			if ($this->result)
				@odbc_free_result($this->result);
			
			parent::Query();
			if (sizeof($parameters) > 0)
			{
				$this->result = @odbc_prepare($this->conn, $query);
				if (!$this->result)
					return -1;
					
				$result = @odbc_execute($this->result, $parameters);
				if (!$result)
					return -1;
			}
			else
			{
				$this->result = @odbc_exec($this->conn, $query);
				if (!$this->result)
					return -1;
			}
			return @odbc_num_rows($this->result);
		}


		function doRead($fetch = DB_FETCH_ARRAY)
		{
			if ($fetch == DB_FETCH_ROW)
			{
				return @odbc_fetch_row($this->result);
			}
			else
			{
				return @odbc_fetch_array($this->result);
			}
		}

$db->doQuery('SELECT strAccountID, strCharID, strClientIP, nServerNo FROM CURRENTUSER WHERE strAccountID = ? AND strClientIP = ?', $_POST[CPD_ID], $this->getRemoteIP());
				
				$row = $db->doRead();
				if (strcmp($_POST[CPD_ID], $row['strAccountID']) !== 0)

now the issue is with getting "$row['strAccountID']"

the value that is it giving it "database            "
and then it is not matching.

any idie what it is like that?

thanks.
danh2 is offline   Reply With Quote