Scott,
    Try using single quotes for the values in your INSERT statement.

    $sSql = "INSERT INTO contacts (first_,last_ ) VALUES 
('$first_','$last_')";

    Quoted identifiers is a setting usually enabled for SQL Server 
connections, and so it thinks you are indicating an attribute (column) 
of an entity (table) and therefore fails.  At least that's my best 
guess for now.

Regards,

> Barry
> 
> I have had a crack at alering a php script written for a mysql 
database but
> instead I want it into a MS SQl database. I though am getting a 
unexplained
> T_variable.
> 
> This is what I have got:-
> 
> <?PHP
> $hostname = "database";
> $username = "login";
> $password = "password";
> $dbName = "database";
> 
> MSSQL_CONNECT($hostname,$username,$password);
> mssql_select_db($dbName) or DIE("Table unavailable");
> 
> $sSql = "INSERT INTO contacts (first_,last_ ) VALUES 
("$first_","$last_")";
> 
> $pResult = mssql_query($sSql, $g_pDBServer);
> print  "Data submitted to database!<p>
>     first_: $first_<br>
>     last_: $last_<br>";
> 
> // Close the database connection
> mssql_close();
> ?>
> 
> 
> Each time I run it though I am getting
> Parse error: parse error, unexpected T_VARIABLE in 
C:\Intranet\Intranet -
> Main Folder\access.php on line 10
> 
> Been looking in google and php.nt - and so far coming up a blank - 
can u
> help put me on the right track.
> 
> Scott
> 
> 
> ----- Original Message -----
> From: "Barry C. Hawkins" <[EMAIL PROTECTED]>
> To: "Hawk" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, February 08, 2003 2:33 PM
> Subject: Re: converting MS SQL to MySQL
> 
> 
> > Hawk,
> > While your script is fairly straightforward in terms of SQL syntax,
> > Transact-SQL and MySQL's dialect of SQL are different enough that 
you
> > will have to modify some things.  Here's a link to the CREATE INDEX
> > syntax page of the online MySQL manual:
> >
> > http://www.mysql.com/doc/en/CREATE_INDEX.html
> >
> > It could be as simple as placing a space between the table name and
> > columns list.  What sort of errors are you getting?  Have you tried
> > creating an index with the command-line utility to see if you can 
get
> > more information on the issue?  Also, what version of MySQL are you
> > running?  The manual states that prior to 3.22 this statement did
> > nothing.  Most folks are on 3.23.5x, but it never hurts to check.
> >
> > Regards,
> >
> >
> >
> > On Thursday, February 6, 2003, at 05:57 PM, Hawk wrote:
> >
> > >
> > >
> > > Hi,
> > >
> > > I am new to SQL.  I am attempting to create a database that was
> > > created in MS SQL to MySQL.  The below SQL statements works with 
MS
> > > SQL.
> > >
> > > I am executing the following:
> > >
> > > CREATE TABLE 'Accounting'(
> > >         'Username' VARCHAR(254) NULL,
> > >         'CallerID' VARCHAR(128) NULL,
> > >         'Addr' VARCHAR(128) NULL,
> > >         'NAS' VARCHAR(128) NULL,
> > >         'Port' VARCHAR(128) NULL,
> > >         'Start' DATETIME NULL,
> > >         'Stop' DATETIME NULL,
> > >         'SessionTime' INTEGER DEFAULT 0,
> > >         'ExtraTime' INTEGER DEFAULT 0,
> > >         'TimeLeft' INTEGER DEFAULT 0,
> > >         'KBytesIn' INTEGER DEFAULT 0,
> > >         'KBytesOut' INTEGER DEFAULT 0,
> > >         'SessionKB' INTEGER DEFAULT 0,
> > >         'ExtraKB' INTEGER DEFAULT 0,
> > >         'KBytesLeft' INTEGER DEFAULT 0,
> > >         )
> > > GO
> > >
> > > CREATE INDEX IX_Username ON Accounting(Username)         <---- 
MySQL
> > > will not take this command
> > > GO
> > >
> > > CREATE TABLE 'ActiveUsers'(
> > >         'UserID' VARCHAR(254) PRIMARY KEY,
> > >         'NAS' VARCHAR(128) NULL,
> > >         'Port' VARCHAR(128) NULL,
> > >         'Username' VARCHAR(254) NULL,
> > >         'CallerID' VARCHAR(128) NULL,
> > >         'Address' VARCHAR(128) NULL,
> > >         'LoginTime' DATETIME NULL,
> > >         )
> > > GO
> > >
> > > CREATE TABLE 'TAC_GRP'(
> > >         'TAC_ID' VARCHAR(254) NOT NULL,
> > >         'TAC_Attr' VARCHAR(64) NOT NULL,
> > >         'TAC_Val' TEXT NULL
> > >         )
> > > GO
> > >
> > > CREATE UNIQUE INDEX IX_TAC_ID ON TAC_GRP(TAC_ID, TAC_Attr)  <----
> > > MySQL will not take this command
> > > GO
> > >
> > > CREATE TABLE 'TAC_USR'(
> > >         'TAC_ID' VARCHAR(254) NOT NULL,
> > >         'TAC_Attr' VARCHAR(64) NOT NULL,
> > >         'TAC_Val' TEXT NULL
> > >         )
> > > GO
> > >
> > > CREATE UNIQUE INDEX IX_TAC_ID ON TAC_USR(TAC_ID, TAC_Attr) <---- 
MySQL
> > > will not take this command
> > > GO
> > >
> > >
> > > Thanks in advance.
> > > ---
> > > [This E-mail scanned for viruses by Friend.ly.net.]
> > >
> > >
> > > ------------------------------------------------------------------
---
> > > Before posting, please check:
> > >   http://www.mysql.com/manual.php   (the manual)
> > >   http://lists.mysql.com/           (the list archive)
> > >
> > > To request this thread, e-mail <mysql-
[EMAIL PROTECTED]>
> > > To unsubscribe, e-mail <mysql-unsubscribe->
> > > [EMAIL PROTECTED]>
> > > Trouble unsubscribing? Try: 
http://lists.mysql.com/php/unsubscribe.php
> > >
> > >
> > >
> > >
> > --
> > Barry C. Hawkins
> > Systems Consultant
> > All Things Computed
> > 404-795-9147 voice/fax
> > [EMAIL PROTECTED]
> >
> >
> > --------------------------------------------------------------------
-
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: 
http://lists.mysql.com/php/unsubscribe.php
> >
> >
> 
> 
> 

-- 
Barry C. Hawkins
Systems Consultant
All Things Computed
[EMAIL PROTECTED]


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to