Hi, can you help me with these 2 problems?
1) What PHP code do I need to edit a row in a MySQL database? For example I understand that you use INSERT INTO to add another row. Can you explain in detail what I would need to do?
2) Also, when using a form to submit text to a MySQL database so far the maximum length the database will accept appears to be 255 characters. How can I get around this?
Many, many thanks,
Leao
editing rows / submitting more than 255 characters of text
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
This is database related and should therefore go in the databases forum.
No I'm too lazy but the MySQL manual can: http://dev.mysql.com/doc/refman/5.0/en/update.htmlan you explain in detail what I would need to do?
VARCHAR max len is 255. TEXT and friends are much greater http://dev.mysql.com/doc/refman/5.0/en/ ... ments.html the mysql manual isn't particularly user friendly in that area, lets just say use SMALLTEXT and you can store up to 64kb, MEDIUMTEXT is bigger etc.maximum length the database will accept appears to be 255 characters. How can I get around this?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Re: editing rows / submitting more than 255 characters of te
Two problems, one quite broad, one simple. I'll do my best to illuminate.Leao wrote:Hi, can you help me with these 2 problems?
Leao wrote:1) What PHP code do I need to edit a row in a MySQL database?
- mysql_connect()
- mysql_select_db()
- either an UPDATE, INSERT, REPLACE or DELETE query.
- mysql_query()
- sprinkling in some mysql_error()'s is good too.
Sorry, I try to hand-hold as little as possible. All I can suggest is some research here, on php.net and Google.Leao wrote:Can you explain in detail what I would need to do?
Both CHAR and VARCHAR types have a maximum of 255. There are a few other TEXT based data types such as TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. If memory serves, the limits are 255 bytes, 64K, 16M and 4GB respectively.Leao wrote:2) Also, when using a form to submit text to a MySQL database so far the maximum length the database will accept appears to be 255 characters. How can I get around this?
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Hi, thanks a lot for your help : ) I've got the UPDATE function working now but it doesn't seem to like text featuring speech marks. I'm using a textarea to UPDATE my mysql. When I submit text featuring speech marks it returns the following message:
'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 'm testing'' at line 1'
Thanks again,
Leao
'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 'm testing'' at line 1'
Thanks again,
Leao