Jump to content

load text


jagguy

Recommended Posts

I want the user to fill out a textbox and have that text upload to a webpage.

Like a news announcement , the user can enter in what they want to say and then send and it appears underneath other text entries (using php/mysql).

 

Now the problem is mysql seems to have a limit on what you can store , especially on the server that hosts my mysql (250 chars limit).

 

I want 500-1000 words max so what can i do?

Link to comment
https://forums.phpfreaks.com/topic/57490-load-text/
Share on other sites

I can't imagine your mysql server (your hosting company's mysql server) has that kind of limits.... it must be your tables which aren't configured / created with the proper properties...

 

You will mainly be using the following three field types:

 

INT or INTEGER

A normal-size integer

The signed range is –2147483648 to 2147483647. The unsigned range is 0 to 4294967295

 

 

VARCHAR

A variable-length string. Note: Trailing spaces are removed when the value is stored (this differs from the ANSI SQL specification)

The range of Length is 1 to 255 characters. VARCHAR values are sorted and compared in case-insensitive fashion unless the BINARY keyword is given

 

BLOB,

TEXT

 

A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters

 

 

So my guess is that the field you use for storing your text is varchar set to 250 characters. Use TEXT or BLOB instead :)

Link to comment
https://forums.phpfreaks.com/topic/57490-load-text/#findComment-284454
Share on other sites

I can't load a large amount of text as i get query failed but it works with say a few lines.

 

Now i changed a varchar feld to longtext and didnt specifiy the length. It fails with this text and works if i truncate it to a few lines.

 

 

"w to load a hard drive in fat32 (super user or root) su - /sbin/fdisk -l (to get the drive number /dev/sdb4 for my fat32 drive) in home dir or any dir mkdir mnt (remember the absolute path because you need to give this) mount -t vfat /dev/sdb4 /home/mnt extract .tar.gz tar -xvzf file.tar.gz hardware details - lsci -vv edit a file gedit filename etc. Let's say as a "for Error, query failed"

 

html code here

 

<form action="guestBook2.php" onsubmit="return validate()" method="post" >
Please type your name<p>
<input name="data1" id="data1" size="40" maxlength="80">
<p> Please type your email-address<p>
<input name="data2" id="data2" size="40" maxlength="80"><br>
<p><h4>Please type your comments (1000 words max.): </h4>
<textarea name="data3" id="data3" rows="6" cols="40"></textarea><br><br>
<input type="submit" value="Send">
</form></p>

 

php

$data1= $_POST['data1'];
$data2 = $_POST['data2'];
$data3= $_POST['data3'];

echo "<h3>You typed in  </h3><br><br> <strong>name :</strong>".
    $data1 . "<br><strong>email :</strong>" . $data2 . "<br> <strong>comments:</strong>"
    . $data3."";


       
$dbhost = 'localhost';
$conn = mysql_connect($dbhost,'root',' ') ;

$dbname = 'formdata';
mysql_select_db($dbname);
mysql_query( "INSERT INTO `personal` ( `id` , `name` , `email` , `comment2` , `date` )
             VALUES (    NULL , '$data1', '$data2', '$data3',CURRENT_TIMESTAMP);")
                or die('Error, query failed');

 

Link to comment
https://forums.phpfreaks.com/topic/57490-load-text/#findComment-284643
Share on other sites

I found the problem as i has quotes in the text. If I remove them manually it works.

 

How do i remove quotes from a string using php because this fails to remove quotes '' and "".

 

$data3= $_POST['data3'];

$data3=str_replace("''", "", $data3) ;

$data3=str_replace("""", "", $data3) ;

 

echo $data3;//has still got quotes in the text.

Link to comment
https://forums.phpfreaks.com/topic/57490-load-text/#findComment-284689
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.