php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17352 DB::execute in DataBase field name have '-'
Submitted: 2002-05-22 03:21 UTC Modified: 2002-05-23 04:58 UTC
From: tokimeki at pchome dot com dot tw Assigned:
Status: Not a bug Package: PEAR related
PHP Version: 4.2.1 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
3 + 12 = ?
Subscribe to this entry?

 
 [2002-05-22 03:21 UTC] tokimeki at pchome dot com dot 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...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-23 04:58 UTC] cox@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC