I really need help to solve this problem. Help me to solve, please do 
not say to ask someone else.
My problem is i have .txt file size of 3-5 kb with long rows. I have a 
mysql table and a column
type of longtext, name "html". What I have to do is: I have to open 
.txt and read inside and
insert the content to "html". My purpose is this but the problem is: I 
easily upload .txt to
server, and read inside, BUT i can not enter it's content to "html". I 
followed the program up to
mysql query row its working correctly but when i write 
mysql_query("INSERT INTO abc
(col1,col2,html) VALUES ('$col1','$col2','$file_contents')") or 
die("ERROR!"); it dies and give
error. My observations: I put $file_contents instead of ERROR! message 
i saw the content, i set
the type of "html" column to longblob, nothing changed: ERROR!, i made 
another .php file which
uses a form, i copied .txt's content manually into <textarea>, it 
succesfully inserted. Then i
made 3 steps program; i uploaded .txt in first step then in second step 
i inserted the content to
a <textarea> as it's value and at the third step i tried to add to 
mysql, message was: ERROR!
again. I tought it may be because of touching the <textarea>'s content 
and i clicked <textarea>
and pressed SPACE BAR :) really but of course nothing changed. One more 
thing i tried to insert by
mysql_query("UPDATE abc SET html='$file_contents' WHERE col1='$col1' 
and col2='$col2'"); but still
it answered "I can not enter this variable to "html"". When i delete 
the long rows it achieves but
i need them and i need to this automatically by selecting the file and 
inserting to mysql. Please
please help me if you can. Below i've added the codes of program. I 
will go insane if i can not
solve it. I am thinking about learning Perl to do that. Thank you very 
much...

<?php
$html="<html>
<head>
        <title>HTML document</title>
<style>input,textarea,td {font-family:verdana;font-size:10px;border:1px 
#2D7BA2
solid;background:#BECCE7} </style>
</head>
<body>
<form action='admin.php' method='POST' ENCTYPE='multipart/form-data'>
<table align='Center'>
<tr>
        <td>Marka:</td>
        <td><input name='alan1' type='Text' size=30 value='$alan1'></td>
</tr>
<tr>
        <td>Ürün Grubu:</td>
        <td><input name='alan2' type='Text' size=30 value='$alan2'></td>
</tr>
<tr>
        <td>Alt Ürün Grubu:</td>
        <td><input name='alan3' type='Text' size=30 value='$alan3'></td>
</tr>
<tr>
        <td>Resmin türü:</td>
        <td><input name='tur' type='Radio' value='jpg' checked>JPG <input 
name='tur' type='Radio'
value='gif'>GIF</td>
</tr>
<tr>
        <td>Dosya:</td>
        <td><input name='file' type='File'></td>
</tr>
<tr>
        <td colspan=2 align='Center'><input type='Submit' value='Yolla'></td>
        </tr>
</table>

</form>
";
if(empty($HTTP_POST_VARS)){echo $html;}
else {
$absolute_path = "../beyazesya/Del";
$size_limit = "var";
$limit_size = "150000";
$limit_ext = "var";
$ext_count = "2";
$extensions = array(".jpg", ".gif");
$geri = "<br><br><a href='#' 
onclick='javascript:history.go(-1)'>Geri</a>";
$endresult = 'DOSYA BAŞARIYLA GÖNDERİLDİ..';
if ($file_name == "") {
$endresult='DOSYA SEÇMEDİNİZ.. $geri';
}else{
if (($size_limit == "var") && ($limit_size < $file_size)) {
$endresult = 'DOSYA ÇOK BÜYÜK, EN FAZLA 150KB OLABİLİR $geri';
} else {
$ext = strrchr($file_name,'.');
if (($limit_ext == "var") && (!in_array($ext,$extensions))) {
$endresult = 'DOSYA TÜRÜ YALNIZCA .ZIP VEYA .RAR OLABİLİR.. $geri';
}else{
[EMAIL PROTECTED]($file, "$absolute_path/file.txt") or die("DOSYA 
KOPYALANAMADI.. $geri");
$dosyam="../beyazesya/Del/file.txt";
$fp=fopen($dosyam,"r") or die("Cant open 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("ERROR!");
if($b) {echo "$html";
$yazili=mysql_query("SELECT * FROM beyaz WHERE alan1='$alan1' AND 
alan2='$alan2' AND
alan3='$alan3'");
echo "<table align=center><tr><td>";
$top_yaz=mysql_num_rows($yazili);
echo "Toplam: <b>$top_yaz</b><hr>";
while($read=mysql_fetch_row($yazili))
{
echo "$read[4]<br>";
}
echo "</td></tr></table>";
}}
else echo "(this record is done before)";
fclose ($fp);
unlink("../beyazesya/Del/file.txt");
$buffer=0;

}}}}
?>

</body>
</html>


                
__________________________________ 
Do you Yahoo!? 
Send holiday email and support a worthy cause. Do good. 
http://celebrity.mail.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to