varchar vs. text?

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

Post Reply
User avatar
halfwing2
Greenhorn
Greenhorn
Posts: 12
Joined: Sun Apr 09, 2006 3:46 am
Location: Fairfield, CA
Contact:

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)";
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

You could use VARCHAR I suppose, but then there will be a limit (of 255 characters I think).
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
halfwing2
Greenhorn
Greenhorn
Posts: 12
Joined: Sun Apr 09, 2006 3:46 am
Location: Fairfield, CA
Contact:

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:
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

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)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
halfwing2
Greenhorn
Greenhorn
Posts: 12
Joined: Sun Apr 09, 2006 3:46 am
Location: Fairfield, CA
Contact:

battye wrote:BTW, don't forget to introduce yourself in our introductory forum.
So it shall be written, so it shall be done..........


Image
Post Reply