I have a default mysql installation on Max OSX 10.2 and this mysql table:
CREATE TABLE docs (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
doc_title VARCHAR(200),
doc_body TEXT,
FULLTEXT (doc_body)
);
The user browses for a text or html document and enters a doc title using an HTML form. I want to put the title and full text of the document into the docs table. My code (below) does put both things in the database, but it puts the title on one row and the document on the next row. Please tell me, how do I get the title and document text to go into the same row?
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
if ($_FILES[filename]!=""){
$today = date("ymdHis");
$path_parts = pathinfo($_FILES[filename][name]);
$file_ext = $path_parts["extension"];
$new_file = "/Library/WebServer/Documents/WorkingDocApp/Docs/" . "$today" . "." . "$file_ext";
@copy($_FILES[filename][tmp_name], "$new_file") or die ("couldn't copy file.");
chmod("$new_file", 0755);
}else{
die("No input file specified.");
}
$insertSQL = sprintf("INSERT INTO docs (doc_title) VALUES (%s)",
GetSQLValueString($HTTP_POST_VARS['doc_title'], "text")
);
$insertSQL2 = sprintf("LOAD DATA CONCURRENT INFILE '$new_file' INTO TABLE docs LINES TERMINATED BY '\n%%\n' (doc_body)");
mysql_select_db($database_connDocs, $connDocs);
$Result = mysql_query($insertSQL, $connDocs) or die(mysql_error());
$Result1 = mysql_query($insertSQL2, $connDocs) or die(mysql_error());