By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

question about using sql server with php

P: 54
i have a question about how to use sql database with php instead of using my sql database

when i use my sql database the php code to connect to the my sql database is =

Expand|Select|Wrap|Line Numbers
  1. $conn = mysql_connect($hostname, $user, $password);
  2.  
  3. if(!$conn)
  4. echo "Unable to connect to Database";
  5. }
  6.  
  7. else
  8. {
  9. mysql_select_db($database, $conn);
  10.  
  11. $query = mysql_query($selectquery);    
  12.  
  13. mysql_close($conn); 
  14. }

if i have to connect to a sql databse instead of my sql database as some companies use sql database, how can i change the php code to connect, run a query and close connection

to the sql database.

apart from changing the code to connect to sql database is there something else i need to do.

php my admin is used to access the tables in mysql database, which tool should be used to access data in the tables for sql database.

please advice.

thanks
Oct 27 '08 #1
Share this Question
Share on Google+
2 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Runway.

To operate on an MS SQL Server database, you'll be using either PHP's mssql (http://php.net/mssql) or odbc methods (http://php.net/odbc).
Oct 27 '08 #2

Markus
Expert 5K+
P: 6,050
Runway27, we here at bytes.com pride ourselves on having a helpful, friendly and ever every-growing community. We ask of this community to follow a set of guidelines that are in place for your benefit. However, these guidelines are not always followed, and when they're not, we inform the user of the issue, point them to the guidelines and hope they see the light. Of course, this is not always how things turn out; the user may ignore all warnings and receive a temporary ban. All of the above is true in your situation.

Now, after a temporary ban comes a permanent ban, but we're not quick to throw around the banhammer on bytes.com; we want to be as helpful and guiding as possible without having to remove offenders. Ergo, it has been decided, in our good nature, to give you a final chance. Make no mistake: if you fail to use code tags, double post, or post outside of the guidelines again, you will be issued with a permanent ban.

I hope you will read the Posting Guidelines especially on 'how to ask a question'.

Moderator.
Oct 27 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.