RE: [PHP] Connecting to MSSQL Using PHP on Apache 2.X.X Windows Machine
| From: | Adam Voigt | Date: | Wed, 18 Jun 2003 15:02:18 +0000 |
| Subject: | RE: [PHP] Connecting to MSSQL Using PHP on Apache 2.X.X Windows Machine | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151988@lists.php.net to get a copy of this message | ||
Actually the @ just supress's error messages.
And even then, the "or die" part would still get
executed if the function error'd out.
On Wed, 2003-06-18 at 10:51, Jay Blanchard wrote:
> [snip]
> <?php
>
> $myServer = "192.92.0.248";
> $myUser = "repro";
> $myPass = "repro";
> $myDB = "repro";
>
> print ("Attempting to connect to MSSQL - <br>");
>
> $s = @mssql_connect($myServer, $myUser, $myPass)
> or die("Couldn't connect to SQL Server on $myServer");
>
> print ("stage2");
>
> $d = @mssql_select_db($myDB, $s)
> or die("Couldn't open database $myDB");
>
> #this is the create bit
> print ("Connected trying to send the query!<br>");
>
> $query = "CREATE TABLE customer (id bigint NULL, cus_name char(100)
> NULL, address1 char(100) NULL, address2 char(100) NULL, town char(50)
> NULL, county char(50) NULL, postcode char(30) NULL, tel char(30) NULL,
> fax char(30) NULL, mobile char(30) NULL, email char(50) NULL, notes
> char(250) NULL)"
> or die("Creating table failed");
>
> $result = mssql_query($query);
>
> print ("Tables Created");
>
> ?>
> [/snip]
>
> See anything wrong here...
> $s = @mssql_connect($myServer, $myUser, $myPass)
> $d = @mssql_select_db($myDB, $s)
>
> ??? Remove the '@' signs and you should go just fine if your user has
> permissions to create tables;
>
> HTH!
>
> Jay
--
Adam Voigt (adam@cryptocomm.com)
Linux/Unix Network Administrator
The Cryptocomm Group