MSSQL using Sybase FreeTDS
| From: | Craig | Date: | Thu, 03 Apr 2003 11:17:50 +0000 |
| Subject: | MSSQL using Sybase FreeTDS | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-142111@lists.php.net to get a copy of this message | ||
Hey all,
Im hoping someone can shed some light on this for me:
Im running PHP 4.31 on RH Advanced Server 2.1
I am connecting, to M$SQL Server 2000 using FreeTDS -- with Sybase support,
and Im stumped on 1 thing:
CODE:
============================================================================
====================
<?php
$ccode = $_POST['ccode'];
$cname = $_POST['cname'];
$cstreet = $_POST['cstreet'];
include("includes/connect.php");
$iqry_clients = mssql_query("INSERT INTO Clients
(client_code,client_name,client_street) VALUES
('$ccode','$cname','$cstreet')");
mssql_close($conn);
?>
============================================================================
====================
The above code works fine, except when one of the fields e.g client_name -
Has a quoted string or an apostrophe in it, it just spews the following
error:
Warning: Sybase error: Line 1: Incorrect syntax near 's'. (severity 15) in
/var/www/html/clients/pages/add_client.php on line 17
Has anyone experienced this, and if so know of a possible solution?? I have
used addslashes() etc but still no joy.
Thanks in advance.
Craig