php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31093 Inserting a new row problem
Submitted: 2004-12-14 19:07 UTC Modified: 2004-12-15 00:56 UTC
From: joshqune at yahoo dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.8 OS: FreeBSD
Private report: No CVE-ID: None
 [2004-12-14 19:07 UTC] joshqune at yahoo dot com
Description:
------------
I have a payed site from www.netfirms.com they use 4.3.6 if understand that problem is because of earlier version and solved in newer ones, i will tell them to upgrade it. Nobody could be able understand this they told me that this may be a bug so i submitted here. Problem is: I upload a .txt file and access inside and take contents. Up to here it is ok but by then i cannot insert this content to mysql table as a new row or updated row. It reads the content and stores in $buffer variable but when it tries to insert into table it can not, besides if i try to insert that content by opening by notepad and manually copy-paste into a textarea it achieves to insert this way. The content is some long like 3-5kbs file size. I set the coloumn type in mysql to longtext but not solved. I don't know the problem is because of me or the system. When i delete the long rows from file it achieves but i can not delete them.

Reproduce code:
---------------
$actt=@copy($file, "$absolute_path/file.txt") or die("No upload.. $geri");$dosyam="../beyazesya/Del/file.txt";$fp=fopen($dosyam,"r") or die("Cant open the file");while(!feof($fp)){$buf = fgets($fp,8192);$buffer=$buffer.$buf;}$buffer=eregi_replace("t","",$buffer);$buffer=trim($buffer);$f_a=$file_name;$model=str_replace(".txt","",$f_a);$resim="$model.$tur";mysql_connect("xxx","yyy","zzz");mysql_select_db("aaa");$bb=mysql_query("SELECT * FROM beyaz WHERE alan1='$alan1' AND alan2='$alan2' AND alan3='$alan3' AND model='$model'");$say_bb=mysql_num_rows($bb);if($say_bb<1){$b=mysql_query("INSERT INTO beyaz (alan1,alan2,alan3,resim,model,html) VALUES ('$alan1','$alan2','$alan3','$resim','$model','$buffer')") or die("Could not insert the row");

Expected result:
----------------
If it can insert that long .txt file's content by textarea it must also insert by opening a file reading inside.

Actual result:
--------------
It cannot insert the .txt file's content to mysql table.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-15 00:56 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

The field in mysql needs to be TEXT or BLOB type.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 08:01:30 2024 UTC