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

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

WBOY
WBOYOriginal
2016-06-13 13:40:331383browse

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"; 

Statement:
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