语法错误意外'mysql_query'(t_string)[重复]

时间:2022-09-08 15:49:32

This question already has an answer here:

这个问题在这里已有答案:

Sorry for asking this question, but I really got stucked with the problem. It seems to me that the code is correct with no syntax errors due to it was copypasted from web and checked in phpmyadmin. But I still have this annoying problem. Give me advice please. Where I am wrong?

很抱歉提出这个问题,但我真的遇到了这个问题。在我看来,代码是正确的,没有语法错误,因为它是从we​​b上复制并在phpmyadmin中检查。但我仍然有这个恼人的问题。请给我建议。哪里错了?

        //$sql = "INSERT INTO orders(name, telephone) VALUES('abc', '123')";
        $sql = "SELECT * FROM orders WHERE name='abc' AND telephone='123'";
        $host = 'localhost';
        $username = 'username';
        $password = 'password';
        $db_name = 'db_name';

        mysql_connect( $host, $username, $password, $db_name )
        mysql_query($sql);

1 个解决方案

#1


You're missing a ; here:

你错过了;这里:

mysql_connect( $host, $username, $password, $db_name )
                                                      ^-- here

#1


You're missing a ; here:

你错过了;这里:

mysql_connect( $host, $username, $password, $db_name )
                                                      ^-- here