Page 1 of 1

varchar vs. text?

Posted: Mon Apr 10, 2006 1:05 am
by halfwing2
Hello,

Is that any reason why we couldn't use "varchar" in the sql data base instead of the currently designated "text"?

Code: Select all

$sql[] = "CREATE TABLE " . QUIZ_MULTIPLE_CHOICE_TABLE . " (
  `quiz_id` int(10) NOT NULL default '0',
  `question_id` int(10) NOT NULL default '0',
  `quiz_question` text NOT NULL,
  `quiz_alternates` text NOT NULL,
  `quiz_answer` text NOT NULL);";

	$sql[] = "CREATE TABLE " . QUIZ_TRUE_FALSE_TABLE . " (
  `quiz_id` int(10) NOT NULL default '0',
  `question_id` int(10) NOT NULL default '0',
  `quiz_question` text NOT NULL,
  `quiz_answer` text NOT NULL);";

	$sql[] = "CREATE TABLE " . QUIZ_INPUT_TABLE . " (
  `quiz_id` int(10) NOT NULL default '0',
  `question_id` int(10) NOT NULL default '0',
  `quiz_question` text NOT NULL,
  `quiz_answer` text NOT NULL)";

Posted: Mon Apr 10, 2006 9:44 am
by battye
You could use VARCHAR I suppose, but then there will be a limit (of 255 characters I think).

Posted: Mon Apr 10, 2006 1:19 pm
by halfwing2
Would that allow non-text characters to be used in the quizzes? I remember reading someplace that if anything other than text was used that there was a problem with accuracy in the scoring.

I actually had one quiz that wasn't scoring correctly, I went through and removed all the contractions and it scored correctly.

I was going to try using varchar in place of text but I wanted to be sure that I wasn't screwing up something you have set to operate a specific way.

BTW, this is an extremely fun mod battye! :supz:

I already see the potential for some wicked fun here. :twisted:

Posted: Mon Apr 10, 2006 1:44 pm
by battye
I have no idea, I am not aware of any character problems with VARCHAR. You could be the first to try it! :P

BTW, don't forget to introduce yourself in our introductory forum (we're only about 30 posts from 1000 in that forum :D)

Posted: Mon Apr 10, 2006 2:05 pm
by halfwing2
battye wrote:BTW, don't forget to introduce yourself in our introductory forum.
So it shall be written, so it shall be done..........


Image