dongzhabo2796 2017-02-25 06:01
浏览 64

简单的MySQL查询显示错误

I am trying to execute the following query

DROP TABLE IF EXISTS `developer_messenger`;
CREATE TABLE `developer_messenger` (
  `id` int(10) NOT NULL,
  `title` varchar(45) NOT NULL,
  `username` varchar(45) NOT NULL,
  `message` varchar(45) NOT NULL,
  `type` varchar(45) NOT NULL,
  `date_time` varchar(45) NOT NULL,
  `status` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

But this simple query is showing me Error in PHP

Could not get data: 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 'CREATE TABLE developer_messenger ( id int(10) NOT NULL, title varchar(' at line 1

I am a newbie, Sorry if its silly,

Help Appreciated!

  • 写回答

2条回答 默认 最新

  • dongxixiu9134 2017-02-25 06:48
    关注

    In Response to your second question about magic_quotes:

    if (!get_magic_quotes_gpc()) { //checks php ini if magic_quotes is not on
    $title = addslashes($_POST['title']);  
    }
    else
    {
    $title = stripslashes($_POST['title']); 
    }
    

    addslashes(); http://php.net/manual/en/function.addslashes.php

    stripslashes(); http://php.net/manual/en/function.stripslashes.php

    not sure if this helps but it might that way you dont have to change php.ini just the $data that is to be entered into sql

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看