0
我會用mysql來存儲與tinymce一起保存的新聞的路徑, 但是從代碼發佈新聞保存在文件夾中並沒有插入到DB中, 奇怪的是我沒有從MySQL獲取任何錯誤。 這裏是我的代碼,感謝和抱歉,形成我的英文不好:dTinymce,php不存儲數據到mysql
<?php
/*
Configuration file
for write_post.php
*/
include ('config_db.php');
$query = "INSERT into news (path,count) values ('$qry', '1')";
$qry = NULL;
$cat= $_POST['cat'] . "/";
$newsTitel = isset($_POST['title']) ? $_POST['title'] : 'Untitled';
$submitDate = date('Y-m-d g:i:s A');
$newsContent = isset($_POST['newstext']) ? $_POST['newstext'] : 'No content';
$qry = $cat.$_POST['title'].".txt";
//$filename = date('YmdHis');
$filename = $newsTitel;
$f = fopen($cat . $filename.".txt","w+");
fwrite($f,$newsTitel."\n");
fwrite($f,$submitDate."\n");
fwrite($f,$newsContent."\n");
fclose($f);
//$post = $cat . $filename . ".txt";
if($mysqli->query($query)){
echo "<br/>";
echo "News inserita con successo!";
}else{
echo "<br/>";
echo "Errore\n" . $mysqli->error;
}
echo "<br/>";
// Try to echo $variable to check if is correct, and is ok but don't go into db
echo $qry;
?>
It Work,thanks;) – starbuck 2013-03-23 15:20:13
在這種情況下,請注意它也很有用!感謝您的反饋! – somnath 2013-03-23 15:23:09