我有这样的文件1248812832.v.doc
,我想从数据库字段中删除字符串和点以使文件像这样1248812832.doc
我使用此代码,但它不能完美运行我仍然看到字符串和点
<?php
$host = 'localhost';
$username = 'root';
$password = '';
$database = 'alsidik';
$conn = mysql_connect($host, $username, $password);
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db($database)) {
echo "Unable to select " . $database . ": " . mysql_error();
exit;
}
$sql = "SELECT * FROM d_jobs";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
while ($row = mysql_fetch_assoc($result)) {
$id = $row['jb_id'];
$jb_cv = $row['jb_cv'];
$jb_rep = preg_replace('/[^.a-z0-9.]/','', $jb_cv);
$sql = "UPDATE d_jobs set jb_cv='" .$jb_rep. "' where jb_id=" . $id;
mysql_query($sql);
}
mysql_close($conn);
?>
谁能帮我..谢谢