Results 1 to 13 of 13

Thread: [RESOLVED] php to MSSQL connection

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    91

    Resolved [RESOLVED] php to MSSQL connection

    I am trying to connect to a godaddy hosted MSSQL database with php. here is my connection string with generic information:

    HTML Code:
    <?php
    $myServer = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";  
    $myUser = "username";
    $myPass = "password";
    $myDB = "dbname"; 
    
    //connection to the database
    $dbhandle = mssql_connect($myServer, $myUser, $myPass)
    	or die("Couldn't connect to SQL Server on $myServer");

    what am I doing wrong? it fails at

    mssql_connection



    thanks everyone.

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: php to MSSQL connection

    That would appear to be a slight spelling mistake:

    PHP Code:
    $dbhandle mysql_connect($myServer$myUser$myPass
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: php to MSSQL connection

    .. lol.

    no, it's not a spelling mistake. MSSQL is another type of database (Microsoft SQL Server), and PHP supports it with functions similar to the MySQL functions; they are prefixed with "mssql_."

    talk to your host and ensure you are using the right server. I know that godaddy has incredibly weird URLs for their MySQL servers, so they might do the same for MSSQL. you could also ask if they might be able to provide some sample code to connect to their MSSQL server -- but, I'm not sure they would be able to provide it.

    edit: also, make sure you're specifying a port in $myServer whenever you're trying to connect; this would be in the format: server:port
    Last edited by kows; Dec 7th, 2009 at 09:58 PM.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    91

    Re: php to MSSQL connection

    I sent a help request to godaddy before I came here. I was confident in the php but thought I would check.

    I will post the solution if godaddy is able to help me out.

    Thanks so far. If anyone notices something I am missing or has a similar godaddy experience I still consider this open.

  5. #5
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: php to MSSQL connection

    I'm not sure if this would help.

    Where can I find database connection strings for my MS SQL database?

    Connection strings can be found in the Hosting Control Center.

    1. Log in to your Account Manager.
    2. In the My Products section, select Hosting.
    3. Next to the hosting account you want to modify, click Manage Account.
    4. In the Databases section of the Hosting Control Center, click the SQL server icon.
    5. Click the pencil icon next to the database you would like to get connection strings for to open its edit features.
    6. Click the Configuration icon in the menu bar.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    91

    Re: php to MSSQL connection

    they do not put a PHP string in there. it would be nice if they did.

    i might have to wait for godaddy to get back with me on this one. google has not been very helpful.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    91

    Re: php to MSSQL connection

    so here is the solution: switch to mysql / PHP solution.

    this was the response from Godaddy.

    Dear SirMadam,

    Thank you for contacting Online Support.

    I apologize for any inconvenience this may have caused. Unfortunately connecting to MS SQL via PHP is not supported.
    thanks everyone for your help.

  8. #8
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: php to MSSQL connection

    Quote Originally Posted by downat420 View Post
    so here is the solution: switch to mysql / PHP solution.

    this was the response from Godaddy.



    thanks everyone for your help.
    What type of account do you have with godaddy?

    I just found this. Looks like you can only get MSSQL on Windows Server 2003 dedicated hosting with godaddy.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    91

    Re: [RESOLVED] php to MSSQL connection

    a windows box, not dedicated, 5 bucks. i get 1 mssql database included or 1000 mysql databases. it is just easier to use mysql. i have no real reason for using mssql except i am more familiar with it.

  10. #10
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: php to MSSQL connection

    I apologize for any inconvenience this may have caused. Unfortunately connecting to MS SQL via PHP is not supported.
    I have to wonder why... Probably just GoDaddy being GoDaddy I guess; I buy domains from them, but I don't think I've heard anything good about their hosting...

  11. #11
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: [RESOLVED] php to MSSQL connection

    I don't like their hosting and the way they have it set up -at all-, it's incredibly annoying. it might be nice for novice "web masters," but I just can't stand it.

    however, I refuse to go anywhere else for domains.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    91

    Re: [RESOLVED] php to MSSQL connection

    thanks for the novice and "web masters" remark.

    i have used them for years. i have used worse hosting services. they are cheap.

  13. #13
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: [RESOLVED] php to MSSQL connection

    Quote Originally Posted by kows View Post
    I don't like their hosting and the way they have it set up -at all-, it's incredibly annoying. it might be nice for novice "web masters," but I just can't stand it.
    Neither can I! I also find their website layout confusing to navigate too.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width