Crazy behavior...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This is really odd. I use this code to retrive value from a database table.
When the field is empty, it cracks the HTML code some how, the PHP script
seam to not break.

	function getInfo() {
		$html = "<table>";
		$html.=
"<tr><th>Name</th><td>".$this->getName()."</td></tr>";
		$html.=
"<tr><th>Description</th><td>".$this->getDesc()."</td></tr>";
		$html.=
"<tr><th>Priority</th><td>".$this->getPriorityText()."</td></tr>";
		
		$html.= "</table>";
		return $html;
	}

The function getDesc is like this (I have made it overly complicated because
I am trying to fix the problem):

	function getDesc() {
		$Query = sprintf("SELECT todotext FROM teamtodo WHERE id=%d
LIMIT 1", $this->getID());
		$Result = mysql_query($Query);
		if(mysql_num_rows($Result)>0) { 
			if($Roww = mysql_fetch_array($Result)) {
				if($Roww['todotext']!='') return
$Roww['todotext'];
				else return '';
			} else return '';
		} else return '';
	}

When the database field is not empty it works fine, but as soon as the field
todotext is empty the $html seam to break, but the value of $html until the
$this->getDesc() is still being returned by the function (can see half of
the table).

Is this a bug, or am I just stupid? If I just insert some blank spaces it
works, hrm.

/Peter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux