Hello,
I have a very simple loop, with a very simple if statement in it. However, my script is returning "text is not text". WTF?
Here is the code, and the sample from the database it is using:
Database:
Code:
How are you?|text
Are you well?|dropdown>Yes:No
Rate this survey!|rating>1:10
PHP:
PHP Code:
//... other stuff // $entities=explode("\n",*Database stuff in above box*); //Explodes the database content above by newlines $i=0; //counter while($e=$entities[$i++]) { $parts=explode("|",$e); //Assings names to the variables created with the split above list($question,$type)=$parts;
echo "<h3>$question</h3>"; //Annoying part that just returns an oxymoron... if ($type=="text") { echo "This is text!"; } else { echo "$type is not text"; } echo "<br /><br />"; }
Can somebody please explain why this is happening? I've also used a foreach statement, but that didn't work either.
Thanks!
Last edited by Physicsguy; 06-18-2011 at 03:07 PM..
|