我有一个用于上传 excel 文件的表格,例如
<form enctype="multipart/form-data" action="http://localhost/joomla/Joomla_1.5.7/index.php?option=com_jumi&fileid=7" method="POST">
Please choose a file: <input name="file" type="file" id="file" /><br />
<input type="submit" value="Upload" />
</form>
并在文件http://localhost/joomla/Joomla_1.5.7/index.php?option=com_jumi&fileid=7
i have retrived the uploaded file contents by
<?php echo "Name". $_FILES['file']['name'] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"] . "<br />";
$string = file_get_contents( $_FILES["file"]["tmp_name"] );
foreach ( explode( "\n", $string ) as $userString )
{
$userString = trim( $userString );
echo $userString;$array = explode( ';', $userString );
$userdata = array
( 'cf_id'=>trim( $array[0] ),
'text_0'=>trim( $array[1] ),
'text_1'=>trim( $array[2] ),
'text_2'=>trim( $array[3] ),
'text_3'=>trim($array[4]),
'text_6'=>trim($array[5]),
'text_7'=>trim($array[6]),
'text_9'=>trim($array[7]),
'text_12'=>trim($array[8]));
global $db; $db=& JFactory::getDBO();
$query = 'INSERT INTO #__chronoforms_UploadAuthor VALUES ("'.$userdata['cf_id'].'","'.$userdata['text_0'].'","'.$userdata['text_1'].'","'.$userdata['text_2'].'","'.$userdata['text_3'].'","'.$userdata['text_6'].'","'.$userdata['text_7'].'","'.$userdata['text_9'].'")';
$db->Execute($query);
echo "<br>";
}
我正在尝试将内容插入到 Joomla 数据库中的表 #__chronoforms_UploadAuthor 中。它没有显示任何错误,但它没有插入到数据库中..
请帮帮我.. Y内容没有插入数据库......以及如何将其插入数据库..
编辑:
我已经回应了查询并将其显示为 INSERT INTO jos_chronoforms_UploadAuthor VALUES ("1",""Concept-paper-WSN_02.pdf"",""Wi-SenseScape,无线传感器网络"",""TCS Innovation Labs, Bangalore" ",""Internal"",""Wi-SenseScape"",""Harish Reddy, Vishnu, Deepika, T.Chakravarty 和 Balamuralidhar"",""2008"","","") .. 因为有2个双引号,它没有插入数据库..请告诉我如何解决这个..
因此查询应该类似于 INSERT INTO jos_chronoforms_UploadAuthor VALUES ("1","Concept-paper-WSN_02.pdf","Wi-SenseScape, 无线传感器网络","TCS Innovation Labs, Bangalore"","Internal"", ""Wi-SenseScap","Harish Reddy、Vishnu、Deepika、T.Chakravarty 和 Balamuralidhar","2008","","")