0

I am making an html and php form to store data in mysql database.Its working fine but for small content of text like 100-200 words but i want it to store around 500 word in database,and I dont know how to do this.My html code is

<form method="post"  enctype="multipart/form-data" action="">
<table>
<tr>
<td width="250">BookName</td>
<td>
<input name="bookname" type="text" id="bookname" /><br />
</td>
</tr>

<tr>
<td width="250">category</td>
<td>
<input name="category" type="text" id="category" /><br />
</td>
</tr>

<tr>
<td width="250">releases</td>
<td>
<input name="releases" type="text" id="releases" /><br />
</td>
</tr>

<tr>
<td width="250">Price</td>
<td>
<input name="price" type="text" id="price" /><br />
</td>
</tr>

<tr>
<td width="500">discription</td>
<td>
<input name="discription" type="text" id="discription" /><br />
</td>
</tr>
<tr>
<td width="250">authorName</td>
<td>
<input name="publicationName" type="text" id="publicationName" /><br />
</td>
</tr>
<tr>

and my php code is

please somebody help me.

9
  • Make the datatype TEXT in mysql for which you want to store large data. Commented Aug 24, 2016 at 9:19
  • In your database dit you use varchar ot text / long text? Commented Aug 24, 2016 at 9:19
  • use datatype LONGTEXT Commented Aug 24, 2016 at 9:20
  • change data type to blob Commented Aug 24, 2016 at 9:33
  • nothing works give same error that file is not uploaded but again for small content it is uploading to server Commented Aug 24, 2016 at 10:19

5 Answers 5

3

Check the documentation

      Type | Maximum length
-----------+-------------------------------------
  TINYTEXT |           255 (2 8−1) bytes
      TEXT |        65,535 (216−1) bytes = 64 KiB
MEDIUMTEXT |    16,777,215 (224−1) bytes = 16 MiB
  LONGTEXT | 4,294,967,295 (232−1) bytes =  4 GiB
Sign up to request clarification or add additional context in comments.

2 Comments

nothing works give same error that file is not uploaded but again for small content it is uploading to server
no error is from html page because when i m editing my sql table then it save the large content so i think threre is no problem from mysql
0

Just use your datatype TEXT in your field to store large data. Don't specify any length in that.

1 Comment

That limits to 64KB and often that's inadequate.
0

use textarea instead of input for large input fields.

it will be better to store the values in the "TEXT" data type. Read the following article for more info

2 Comments

nothing works give same error that file is not uploaded but again for small content it is uploading to server
@NickyManali There is no file input in your form?
0

Use data type TEXT in your database against the field you want to save max data, and use <input type="textarea" name="name of your filed" in html form.

4 Comments

nothing works give same error that file is not uploaded but again for small content it is uploading to server
from which field you are trying to save the large content ? do mention the name of fields please..
discription field
replace your description field code(html) with this one <textarea name="discription" id="discription" /> </textarea><br /> and in MySQL change the datatype to LONGTEXT like below (tinypic.com/view.php?pic=4ugwph&s=9#.V72DZvl97IU)
0

Alternatively you can add text in word document and upload it on server and save file name instead of directly inserting text into the database.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.