Home > Backend Development > PHP Tutorial > 请问php 使用mysql_query时遇到的奇怪有关问题

请问php 使用mysql_query时遇到的奇怪有关问题

WBOY
Release: 2016-06-13 11:08:02
Original
986 people have browsed it

请教php 使用mysql_query时遇到的奇怪问题。

<br />$uid='6';<br />$result = mysql_query("SELECT * FROM user WHERE uid='$uid'")<br />    or die("Invalid query: " . mysql_error());<br />print_r(fetch_array($result));<br />
Copy after login

可以调用出数据uid=>6;username=>匿名。
但是下边这个就调用不出来数据,而且也不报错。的。
<br />$username='匿名';<br />$resultt = mysql_query("SELECT * FROM user WHERE username='$username'")<br />    or die("Invalid query: " . mysql_error());<br />print_r(fetch_array($resultt));<br />
Copy after login

求指教。
ps:数据库连接肯定没问题,这两段代码是放在一个文件里运行
------解决方案--------------------
输出语句看看,多半是编码的问题
echo $resultt = mysql_query("SELECT * FROM user WHERE username='$username'")    or die("Invalid query: " . mysql_error());
Copy after login

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