neohunter Posted November 27, 2006 Share Posted November 27, 2006 Hi, i have this function: function DescFileToSql(){ $miconexion = new DB_mysql; $miconexion->conectar("unionro_intranet", "localhost", "root", "mypassword"); foreach($this->loadFile('idnum2itemdesctable.txt') as $key => $value){ $value = str_replace("'","\'",$value); $querry="UPDATE `item_db` SET `desc` = '".$value."' WHERE item_db.id = $key;"; $miconexion->consulta($querry); $miconexion->verconsulta(); if($miconexion->Error){ echo "<b>$key:</b>:<br>"; echo $querry; echo "<font color=#ff0000>".$miconexion->Error."</font>"; echo "<br>"; } } }and give me this error:UPDATE `item_db` SET `desc` = 'A tame for the monster: Argos -=- Happy Catching Item Class : ^777777Pet Tame^000000 Weight : ^77777720^000000 ' WHERE item_db.id = 9606;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 '' at line 1but i execute the querry that gives me on phpmyadmin and works. what happend? Link to comment https://forums.phpfreaks.com/topic/28642-mysql-error/ Share on other sites More sharing options...
Caesar Posted November 27, 2006 Share Posted November 27, 2006 Try:[code]<?php$querry="UPDATE item_db SET desc ='$value' WHERE item_db.id = '$key'";?>[/code] Link to comment https://forums.phpfreaks.com/topic/28642-mysql-error/#findComment-131115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.