Home >Backend Development >PHP Tutorial > sql中执行没有关问题php中执行出错~
sql中执行没问题php中执行出错~~
错误是Access denied for user: 'ODBC@localhost' (Using password: NO)
我之前用的也是空密码,也没出错,现在其他文件也没出错,就这一个出错,贴出代码如下
<br /> <?php<br /> error_reporting(0);<br /> session_start();<br /> require('../libs/Smarty.class.php');<br /> $smarty = new Smarty;<br /> //$smarty->force_compile = true;<br /> $smarty->debugging = false;<br /> $smarty->caching = false;<br /> $smarty->cache_lifetime = 120;<br /> <br /> <br /> <br /> if($_POST['ok'].value==1)<br /> {<br /> $username=$_POST['username'];<br /> $userpwd=$_POST['userpwd'];<br /> $query=mysql_query("INSERT INTO user (user,pwd) values <br /> <br /> ('$username','$userpwd')")or die(mysql_error());<br /> if($query)<br /> {<br /> $response="<script>alert('注册成功');</script><br /> <meta http-equiv=refresh content='0; url=login.php'>";<br /> }<br /> else<br /> {<br /> $response="<script>alert('注册失败');</script>";<br /> <br /> }<br /> }<br /> $smarty->assign("regstatus",$response);<br /> $smarty->display("reg.html");<br /> ?><br />