Solved

MYSQL migration to MS sql 2005 using PHP

Posted on 2006-10-19
7
204 Views
Last Modified: 2013-12-12
hi
im currenly using Mysql as my database manager, however i'd now like to use MSSQL 2005,
my question is, what steps do i need to take to make the change (in terms of updating the PHP code)

are there any differences in the query and connection strings?

are the full text search strings also the same ?

eg.
$sql = "

            SELECT *,
            MATCH (item,description) AGAINST ('$query') AS score
                FROM items
            WHERE MATCH (item,description) AGAINST ('$query')
            ORDER BY score DESC

        ";
does any of this need to be changed?

thanks
0
Comment
Question by:intazaar
  • 4
  • 3
7 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
if you use mysql_xxxx functions, you will have to replace them all by the corresponding mssql_xxxx functions, and note that not all functions have the same name or behave exactly the same way.

>are the full text search strings also the same ?
not at all:
http://msdn2.microsoft.com/en-us/library/ms142559.aspx
0
 

Author Comment

by:intazaar
Comment Utility
can you tell me which functions that 'dont behave the same way'?


and what would the code below be if it were converted to sql 2005

$sql = "

            SELECT *,
          MATCH (item,description) AGAINST ('$query') AS score
                FROM items
            WHERE MATCH (item,description) AGAINST ('$query')
            ORDER BY score DESC

        ";
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
I see you posted already a new question, please delete it, I will follow-up here, please be patient... just getting the infos to post...
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
you need either FREETEXT:
http://msdn2.microsoft.com/en-us/library/ms176078.aspx

or the CONTAINSTABLE:
http://msdn2.microsoft.com/en-us/library/ms189760.aspx

the links contain samples... if you really want to (have to) migrate, take the time to learn them...



in regards to functions that don't have the same name and/or behaviour:
mysql_error()  -> mssql_ get_ last_ message()  , but that function gives also warnings...
all mssql_xxx functions of php:
http://php.net/function.mssql-query

0
 

Author Comment

by:intazaar
Comment Utility
ok... then...

the current code below is for MYSQL-PHP what would be the code to give me the saem result for MSSQL. NOTE: the 'score' syntax

$sql = "

            SELECT *,
          MATCH (item,description) AGAINST ('$query') AS score
                FROM items
            WHERE MATCH (item,description) AGAINST ('$query')
            ORDER BY score DESC

        ";

0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
it would look like this:
$sql = "
SELECT i.* , r.RANK as score
    FROM Items i
    INNER JOIN CONTAINSTABLE(items, item,Description,
        'ISABOUT  $query ' ) AS r
            ON i.itemid = r.[KEY]
ORDER BY r.RANK DESC
";
0
 

Author Comment

by:intazaar
Comment Utility
thank you
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now