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.

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab求解平差
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法