MySQL中的错误使用正确的语法 [英] error in MySQL the right syntax to use

查看:72
本文介绍了MySQL中的错误使用正确的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

require_once''head.php'';

$ query =SELECT''name'',''pass''FROM''users''; // ERROR HERE

if($ run_query = mysql_query($ query))

{

echo''success'';

}否则

{

echo mysql_error();

}

?>



这里是返回错误

require_once ''head.php'';
$query = "SELECT ''name'', ''pass'' FROM ''users''"; //ERROR HERE
if($run_query = mysql_query($query))
{
echo ''success'';
}else
{
echo mysql_error();
}
?>

here is the return error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''users'' at line 1





i试图修复它并且新错误即将获得



i tried to fix it and the new error im getting

$query = "SELECT `name`, `pass` FROM `users`"; //Error: No database selected




$query = "SELECT name, pass FROM users"; //Error: No database selected





代码有什么问题?任何人都可以帮忙吗?谢谢

即时通讯使用xampp的最新版本,我也尝试了旧版本1.7.4但仍然无法正常工作



what is wrong with the code ? any one can help pls ? thanks
im using the latest versio of xampp and also i tried the older version 1.7.4 but still doesnt work

推荐答案

query =选择''name'',''传递''FROM''用户'''; // ERROR HERE

if(
query = "SELECT ''name'', ''pass'' FROM ''users''"; //ERROR HERE
if(


run_query = mysql_query(
run_query = mysql_query(


query))

{

echo''成功'';

}否则

{

echo mysql_error();

}

?>



这里是返回错误

query))
{
echo ''success'';
}else
{
echo mysql_error();
}
?>

here is the return error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''users'' at line 1





i试图修复它并且新错误即将获得



i tried to fix it and the new error im getting


这篇关于MySQL中的错误使用正确的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆