How can I........
Moderator: General Moderators
How can I........
I was wondering if when someone submits a txt file and the contents of the text file can be inserted in a mysql table acording to the name of the textfile. and then reading the information that was inserted in the MySQL database, and then using the include form, the information is inserted into a HTML page. Can this be possible?!?
Don't know about the file name of text but you can insert the txt file's content in to MySQL:-
This should work although I haven't tested it. 
Code: Select all
<?php
//INSERT DATA INTO TABLE CALLED "txt" which has 2 fields (one is ID auto_incremented).
$sql = "INSERT INTO txt VALUES(NULL,"{$_POSTї'TEXTFILE']}")";
$temp = mysql_query($sql);
//READ DATA
$sql = "SELECT id FROM txt WHERE id = 'ID NUMBER'";
$temp = mysql_query($sql);
list($result) = mysql_fetch_array($temp);
echo $result;
?>When inserting into a table with an auto-increment do it like this
$sql = "INSERT INTO txt (textcontent) values ('$ValueToBeInserted')";
txt (textcontent) this part specifies all of the fields you want to insert into seperated by commas, you must do this if you are not inserting into all fields. Do not include the auto-increment field and do not try to pass NULL, as Takumas insert query would do.
$sql = "INSERT INTO txt (textcontent) values ('$ValueToBeInserted')";
txt (textcontent) this part specifies all of the fields you want to insert into seperated by commas, you must do this if you are not inserting into all fields. Do not include the auto-increment field and do not try to pass NULL, as Takumas insert query would do.