Jump to content


Photo

Explode() help


  • Please log in to reply
1 reply to this topic

#1 Nostal

Nostal
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 September 2006 - 06:31 PM

while($row = mysql_fetch_array($result)) {
	echo "<tr><td width='40%' bgcolor='#666666'>";
	echo "<div class='hbfield2'><a href='?cat=characters&id=$row[id]'>".$row[name]."</a></div>";
	echo "</td><td width='40%' bgcolor='#666666'>";

		while($row = mysql_fetch_array($result)) {
			$series = explode(" ", $row[series]);

			if ($series[0]=="1"){
			$series[0] = "<div class='hbfield2'>Event Zero</div>";
			}
			else{
			$series[0] = "";
			}

			if ($series[1]=="1"){
			$series[1] = "<div class='hbfield2'>The Radicals</div>";
			}
			else{
			$series[1] = "";
			}

			if ($series[2]=="1"){
			$series[2] = "<div class='hbfield2'>The Paladins</div>";
			}
			else{
			$series[2] = "";
			}

			if ($series[3]=="1"){
			$series[3] = "<div class='hbfield2'>Event Zero, The Radicals</div>";
			}
			else{
			$series[3] = "";
			}

			if ($series[4]=="1"){
			$series[4] = "<div class='hbfield2'>Event Zero, The Paladins</div>";
			}
			else{
			$series[4] = "";
			}

			if ($series[5]=="1"){
			$series[5] = "<div class='hbfield2'>The Radicals, The Paladins</div>";
			}
			else{
			$series[5] = "";
			}

	echo "$series";

		}

	echo "</td><td width='20%' bgcolor='#666666'>";
	echo "<div class='hbfield2'>".$row[affiliation]."</div>";
	echo "</td></tr>";
}

Could anyone tell me what might be wrong with this code and also tell me what type of mysql table field type I would need to create a field for "0 0 0 0 0 0" where a "1" would mean it is "activated/on" kind of how binary functions?

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 16 September 2006 - 11:26 PM

Well, there's no reason why you can't use the new BIT field type.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users