Varchar is too big I guess.
Moderator: General Moderators
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
Varchar is too big I guess.
Howdy. I'm logging battles for my game, right, and these logs can get -big-.
The problem here is I try to add the log to the database... the log itself is fine, I've printed it with echo and it runs well. But I tried to put the battle log into "mediumblob" mode, and I guess it's the formatting tags (<b> for bold and stuff). So I figured, okay, we'll just use varchar. Oh no no. It doesn't want me to do that. I keep changing varchar to be like varchar(999999) and it changes back to "mediumtext". I need like 500,000 chars at most, but still it won't let me.
What should I do?
The problem here is I try to add the log to the database... the log itself is fine, I've printed it with echo and it runs well. But I tried to put the battle log into "mediumblob" mode, and I guess it's the formatting tags (<b> for bold and stuff). So I figured, okay, we'll just use varchar. Oh no no. It doesn't want me to do that. I keep changing varchar to be like varchar(999999) and it changes back to "mediumtext". I need like 500,000 chars at most, but still it won't let me.
What should I do?
-
thunderbox
- Forum Newbie
- Posts: 13
- Joined: Wed Mar 07, 2007 4:06 pm
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
=/ Got the problem.
I set the battlelog to be like..
$battlelog .= "(what happens)" then at the end of the battle, it just throws out the battlelog. That works well, and keeps the "s and 's in there. However, upon sending it to the database, it trips over the first ' it sees.
Could not connect:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's message:
"I challenge thee to a duel of massive proportions."
And, that's the first thing that shows up. The battle starts off like...
Challenger's message:
"I challenge thee to a duel of massive proportions."
But even then, it doesn't even get to the fighters' battle to screw up, though when I "fix" the message to work, it will, and then still screw up when I change the font to red because I had to use font='red'
What should I do? Am I really going to have to store each log in a seperate text file and just print that out?
I set the battlelog to be like..
$battlelog .= "(what happens)" then at the end of the battle, it just throws out the battlelog. That works well, and keeps the "s and 's in there. However, upon sending it to the database, it trips over the first ' it sees.
Could not connect:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's message:
"I challenge thee to a duel of massive proportions."
And, that's the first thing that shows up. The battle starts off like...
Challenger's message:
"I challenge thee to a duel of massive proportions."
But even then, it doesn't even get to the fighters' battle to screw up, though when I "fix" the message to work, it will, and then still screw up when I change the font to red because I had to use font='red'
What should I do? Am I really going to have to store each log in a seperate text file and just print that out?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
Oh wow. I think I actually get it.. so it will strip the correct stuff away.
And is this used for security purposes, also? There's no insertable fields... you just click to do the battle and it goes.
Edit: Hmm... tried it and it didn't fix it. =/ I'll try escaping more things I guess.
And is this used for security purposes, also? There's no insertable fields... you just click to do the battle and it goes.
Edit: Hmm... tried it and it didn't fix it. =/ I'll try escaping more things I guess.
Last edited by Mightywayne on Sun Apr 15, 2007 1:27 pm, edited 1 time in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
I have no idea what you just said, please rephrease.Mightywayne wrote:I am, but if they have to field to insert SQL commands into, how will they put the SQL in?
It would be helpful to see your code, to make sure you are doing things correctly.Mightywayne wrote:Edit: I don't know what I did. I think I did something with quotes and escaping. But I just got it to work. ^^
-
Mightywayne
- Forum Contributor
- Posts: 237
- Joined: Sat Dec 09, 2006 6:46 am
Sorry, I'm being distracted by terrible things I don't want to mention.
I am, but if they have no field to insert SQL commands into, how will they put the SQL in?
And the code's really big and I frankly don't feel comfortable posting my whole battle script in the open, and since people don't seem to like to help on a personal level (I don't blame you), I'll just work out the current problems I have, I guess.
Edit: It broke again because I can't use INSERT. I have to use UPDATE to add it, and I can't do that, because I guess it just doesn't like that.
Edit 2: Okay, I got it I think. I can't use double quotes for my message, which kinda sucks, I'm sure I'll figure out a way for it work eventually. The problem was inserting '$log', instead I did \"$log\" and it loved me again.
I am, but if they have no field to insert SQL commands into, how will they put the SQL in?
And the code's really big and I frankly don't feel comfortable posting my whole battle script in the open, and since people don't seem to like to help on a personal level (I don't blame you), I'll just work out the current problems I have, I guess.
Edit: It broke again because I can't use INSERT. I have to use UPDATE to add it, and I can't do that, because I guess it just doesn't like that.
Edit 2: Okay, I got it I think. I can't use double quotes for my message, which kinda sucks, I'm sure I'll figure out a way for it work eventually. The problem was inserting '$log', instead I did \"$log\" and it loved me again.