dpbz14739 2015-08-18 07:29
浏览 81

与MariaDB的PHP代码中的MySql错误

When I try to create new entries to a mysql table and bring variables from one php file to another with start_session() I get the following error:

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 2

My code looks like this:

session_start();  

$servername = "xxx";  
$username = "johndoe";  
$password = "password";  
$dbname = "databese";  

try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", 
                    $username, $username, $password);

First of all there is nothing in line 2.

session_start() was working before with the same file when I created the table.

Any Idea?

  • 写回答

1条回答

  • drlu11748 2015-08-18 23:33
    关注

    And when you locate the query, look at the end of it. I'll guess you have an extra right paren.

    评论

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services