Home > Backend Development > PHP Tutorial > php清空数据库中一个表中的内容的代码解决思路

php清空数据库中一个表中的内容的代码解决思路

WBOY
Release: 2016-06-13 13:40:33
Original
1452 people have browsed it

php清空数据库中一个表中的内容的代码
哪位高手知道怎么来用php代码清空数据库中一个表中的内容。我知道清空语句是
$sqlm = "TRUNCATE TABLE 'dede_co_mediaurls'";
$rm = mysql_query($sqlm);
if($rm)
{
echo "已经清空";
}
else
{
echo "出问题啦";
}
可是不对呀,帮小弟看看哦

------解决方案--------------------
$sqlm = "TRUNCATE TABLE 'dede_co_mediaurls'"; 
你的sql有误,应该是没有引号:
$sqlm = "TRUNCATE TABLE dede_co_mediaurls"; 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template