|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
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