我已经通过所有其他stackoverflow(和谷歌)职位与同样的问题,但似乎没有解决我的问题。 我正在使用pdo和php。 我的代码: $vals = array( ':from'=>$email, ':to'=>$recipient, ':name'=>$name, ':subject'=>$subject, ':message'=>$message ); print_r($vals); try { $pdo = new PDOConfig(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM messages WHERE `message` LIKE :message"; $q = $pdo->prepare($sql); $q->execute(array(':message' => $vals[':message'])); $resp = $q->fetchAll(); foreach ($resp as $row) { throw new Exception('Please do not post the same message twice!'); […]
我得到这个错误: 你的SQL语法有错误, 检查对应于您的MySQL服务器版本的手册,以便在's','portal',''offering','MSNBC','News','','sports','', 'MSN','Money','','游戏'在第3行 唯一的问题是插入包含撇号的数据时出现此错误。 我尝试将数据types从VARCHAR更改为TEXT,但结果仍然相同。 我试图把addslashes() 如何解决这个问题? 编辑: $query=" INSERT INTO alltags (id,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10,tag11,tag12,tag13,tag14,tag15,tag16,tag17,tag18,tag19,tag20,tag21,tag22,tag23,tag24,tag25,tag26,tag27,tag28,tag29,tag30) VALUES ('',mysql_real_escape_string($uniqkey[0]),mysql_real_escape_string($uniqkey[1]),mysql_real_escape_string($uniqkey[2]),mysql_real_escape_string($uniqkey[3]),mysql_real_escape_string($uniqkey[4]),mysql_real_escape_string($uniqkey[5]),mysql_real_escape_string($uniqkey[6]),mysql_real_escape_string($uniqkey[7]),mysql_real_escape_string($uniqkey[8]),mysql_real_escape_string($uniqkey[9]),mysql_real_escape_string($uniqkey[10]),mysql_real_escape_string($uniqkey[11]),mysql_real_escape_string($uniqkey[12]),mysql_real_escape_string($uniqkey[13]),mysql_real_escape_string($uniqkey[14]),mysql_real_escape_string($uniqkey[15]),mysql_real_escape_string($uniqkey[16]),mysql_real_escape_string($uniqkey[17]),mysql_real_escape_string($uniqkey[18]),mysql_real_escape_string($uniqkey[19]),mysql_real_escape_string($uniqkey[20]),mysql_real_escape_string($uniqkey[21]),mysql_real_escape_string($uniqkey[22]),mysql_real_escape_string($uniqkey[23]),mysql_real_escape_string($uniqkey[24]),mysql_real_escape_string($uniqkey[25]),mysql_real_escape_string($uniqkey[26]),mysql_real_escape_string($uniqkey[27]),mysql_real_escape_string($uniqkey[28]),mysql_real_escape_string($uniqkey[29])) "; mysql_query($query) or die(mysql_error()); 我将其更改为mysql_real_escape_string 。 这个语法是正确的吗? 我收到错误。
SELECT airline, airports.icao_code, continent, country, province, city, website FROM airlines FULL OUTER JOIN airports ON airlines.iaco_code = airports.iaco_code FULL OUTER JOIN cities ON airports.city_id = cities.city_id FULL OUTER JOIN provinces ON cities.province_id = provinces.province_id FULL OUTER JOIN countries ON cities.country_id = countries.country_id FULL OUTER JOIN continents ON countries.continent_id = continents.continent_id 它说 你的SQL语法有错误; 检查对应于您的MySQL服务器版本的手册,以便在第4行的“airlines.iaco_code = airports.iaco_code […]
向MySQL发出命令时,出现错误#1064“语法错误”。 这是什么意思? 我该如何解决?