php-windows Digest 21 Jun 2006 17:20:04 -0000 Issue 3000
Topics (messages 27047 through 27049):
Re: PHP and SQL Server 2005
27047 by: Dale D. Attree
LDAP
27048 by: Dale D. Attree
Transactions and PDO
27049 by: Vandegrift, Ken
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Thanks.
This problem has been resolved. My problem was that SQL Server had been
configured with Window Authentication and not Mixed Mode.
-----Original Message-----
From: Frank M. Kromann [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 21, 2006 5:56 AM
To: [EMAIL PROTECTED]
Cc: Dale D. Attree; [email protected]
Subject: Re: [PHP-WIN] PHP and SQL Server 2005
The SQL Server is configured to only allow connections from trusted
users.
Use mssql.secure_connection = 1 in php.ini when connection to the
server.
- Frank
> What is your connection string?
>
> Tryst
>
> -----Original Message-----
> From: Dale D. Attree <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Mon, 19 Jun 2006 14:32:37 +0200
> Subject: [PHP-WIN] PHP and SQL Server 2005
>
> If anyone can help, please do.
>
>
>
> Warning: mssql_connect() [function.mssql-connect
> <http://kwikmobile/WLIM/function.mssql-connect> ]: message: Login
failed
> for user 'dalea'. The user is not associated with a trusted SQL Server
> connection. (severity 14) in C:\webdev\www\WLIM est.php on line 7
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi,
Has anyone got LDAP for PHP 5 working on IIS?
Kind Regards,
Dale
--- End Message ---
--- Begin Message ---
Just wanted to throw this out there to see if anyone may be able to help
with a PDO transaction that does not appear to be working. I want to
update an order record in the database and also insert giftcard numbers
associated with this same order into another table. So I am trying to
do one update in the customer order table and possibly several inserts
into a giftcard record table. I purposely use the same giftcard number
to trigger a primary key violation and attempt to rollback the
transaction if this occurs. I know users of the system will likely
enter the same giftcard numer at some point (although I will have
validation schemes in place to prevent db errors)
Running Windows 2003 Server IIS6 and PHP 5.1.2
Code example:
/**
* Updates order information in the database.
* Called from Order::dbSaveOrder
* @return boolean true on success
* @access protected
*/
protected function dbUpdateOrder() {
// VARIABLES TO TRACK PROPER SQL FORMATTING
$count = count($this->attributes);
$i = 1;
// BUILD ORDER TABLE UPDATE QUERY
$sql = "UPDATE " . ORDER_TABLE . " SET ";
foreach ($this->attributes as $attribute => $value) {
$attribute = strtoupper($attribute);
$sql .= (is_string($value) || is_null($value)) ? "{$attribute} =
'{$value}'" : "{$attribute} = {$value}";
if ($i < $count) {
$i++;
$sql .= ", ";
}
}
$sql .= " WHERE " . ORDER_TABLE_ID . " = :orderid;";
try {
$this->db->beginTransaction();
$stmt = $this->db->prepare($sql);
$stmt->execute(array(':orderid' => $this->attributes['order_id']));
$stmt = null;
// SAVE GIFT CARD NUMBERS RECORDED FOR THIS ORDER
if (!empty($this->gcnums)) {
$sql = null;
foreach ($this->gcnums as $itemid => $gcnumbers) {
foreach ($gcnumbers as $gcnum) {
$sql .= "INSERT INTO GIFTCARD_RECORD " .
"(" .
"ORDER_ID, " .
"ITEM_ID, " .
"GC_NUM " .
") " .
"VALUES" .
"(" .
"{$this->__get('order_id')}, " .
"{$itemid}, " .
"'{$gcnum}'" .
");";
} // End Inner FOREACH
} // End Outer FOREACH
$stmt = $this->db->prepare($sql);
$stmt->execute();
}
$this->db->commit();
return true;
}catch (PDOException $e) {
$this->db->rollBack();
Log::write(LOG_DIR, 'order',
"\r******** Order::dbUpdateOrder ********\r" .
"[UPDATE SQL] => " . $sql . "\r" .
"[DB ERROR] => " . $e->getMessage() . "\r" .
"**************************************"
);
$this->error = 'The system has encountered an error and is unable to
update this order. ' .
'Please contact the system administrator.';
$stmt = null;
return false;
}
}
Ken Vandegrift
--- End Message ---