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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tokimeki at pchome dot com dot tw
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Mon Feb 24 06:01:26 2020 UTC