Re: PHP and Microsoft SQL 7

From: Date: Tue, 10 Oct 2000 12:37:50 +0000
Subject: Re: PHP and Microsoft SQL 7
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-19322@lists.php.net to get a copy of this message
Try mssql_query("insert into news set (field1,field2,field3,field4,field5,field6) values ($ar,$manad,$dag,$tid,$head,\"$content\")"); instead of mssql_query("insert into news values(NULL,'%s-%s-%s','%s','%s','%s')", $ar,$manad,$dag,$tid,$head,$content) or die("Invalid Query"); replacing field1...6 with field names and enclosed character fields with quotes, escaping the quote escaped like this \" Hope this helps Andy Woolley M.D. www.databasewatch.com ----- Original Message ----- From: "Jari Ivanoff" <jari.ivanoff@telia.com> To: <php-general@lists.php.net> Sent: Tuesday, October 10, 2000 12:30 PM Subject: [PHP] PHP and Microsoft SQL 7 > > > I am trying to make an insert into a SQL database via a html form. > It is for a newspage on our intranet. > I think I have got everything working except the insert: > > mssql_query("insert into news > values(NULL,'%s-%s-%s','%s','%s','%s')", > $ar,$manad,$dag,$tid,$head,$content) or die("Invalid Query"); > > I get the following errormessage: > Warning: Wrong parameter count for mssql_query() in c: > \apache\htdocs\news\newsin.php on line 10 > Invalid Query > > I have tried to use NULL, 0 and nothing at all for the first field. > The $head and $content is passed from the form I use. > > The fields in the database is as follows: > id int (unique autoincrement identifier ) > date varchar ( the date of the posting yyyy-mm-dd) > time varchar ( the time of the posting hh:mm:ss ) > head varchar ( the head of the posting ) > content varchar ( the content of the posting ) > > I generate the time and date in the script since I don't know how to > get the SQL to generate it in the format I want. > In MySQL I could use currentdate() and currenttime(), but since I have > to use MSSQL... > > > Jari Ivanoff > jari.ivanoff@telia.com > +46-(0)70-3142556 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#19322) next »