Jump to content

Recommended Posts

Posted

Hello ,

 

first , i know that using hyphens "-" in a variable is not recommanded , we should use "_" instead . but for a porject i work for it, the client already has a big and tremendous data , and almost is impossible forit to change this , and we are forced to work the hyphens .

 

i get a sql query error

SQLSTATE[42000]: Syntax error or access violation: 1064 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 '-`depends`='12346',`status`='active'' at line 1 on line .....

i have the fallowing code in a model

$fields = array("package", "name", "version", "depends" , "pre-depends",  "status"   );
 
$this->Record->where("id", "=", $package_id)->update("packages", $vars, $fields);

when i remove the "pre-depends" from the fields it work perfectly .

 

i have tried  "{pre-depends}" ; "pre\-depends" without success .

 

 

how i can pass this without hacking he core record.php ?

Posted

maybe you could include a variable conversion list like

 

$original-variable1 =  $variable1;

$original-variable2 =  $variable2;

etc...

 

 

in adition function like preg_replace();

can remove the dash from a given list, but it realy depend if you need something dynamic or just like above static list is enought

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...