Bug #17352 Updated: DB::execute in DataBase field name have '-'

From: Date: Thu, 23 May 2002 08:58:10 +0000
Subject: Bug #17352 Updated: DB::execute in DataBase field name have '-'
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6356@lists.php.net to get a copy of this message
ID: 17352 Updated by: cox@php.net Reported By: tokimeki@pchome.com.tw -Status: Open +Status: Bogus Bug Type: PEAR related Operating System: Windows XP PHP Version: 4.2.1 New Comment: Try this way: $SQL="INSERT INTO League_Base (!) VALUES (?)"; $params=array('zh-twName','foo'); Or if the database field is not going to change directly: $SQL="INSERT INTO League_Base (zh-twName) VALUES (?)"; $params=array('foo'); Tomas V.V.Cox PS.- Please for support questions go in the future to pear-general@lists.php.net or pear-dev@lists.php.net Previous Comments: ------------------------------------------------------------------------ [2002-05-22 03:21:45] tokimeki@pchome.com.tw <code> $DBX=DB::connect($DSN); $SQL="INSERT INTO League_Base (?) VALUES ('?')"; $params=array('zh-twName','foo'); $stmt=$DBX->prepare($SQL); $Result=$DBX->execute($stmt,$params); if(DB::isError($Result)) $Message='ERROR'; else $Message='OK'; echo $Message; </code> it always show 'ERROR'. When I change DataBase Field Name from zh-twName to Name, it show 'OK'... now, I use another way to do it... <code> $DBX=DB::connect($DSN); $SQL="INSERT INTO League_Base (%s) VALUES ('%s')"; $SQL=sprintf($SQL,'zh-twName','foo'); $Result=$DBX->query($SQL); if(DB::isError($Result)) $Message='ERROR'; else $Message='OK'; echo $Message; </code> it's OK... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17352&edit=1

« previous php.pear.dev (#6356) next »