I currently have a large web application that connects to MSSQL to fetch its data. This web app has hundreds of .php files. I have a new customer, and he doesn't want to use MSSQL, but MySQL instead.
I've searched and found lots of articles on how to migrate data. But that's not my problem. I know how to do that, besides we'll be starting with a blank database, except for a few default catalogs.
What I need to know is if there's a way to automatically change the mssql_query code to mysqli code. For example:
$SqlText = 'SELECT a, b, c FROM table WHERE x=y';
if (!$result = mssql_query($SqlText) {
die('Error');
}
while ($row = mssql_fetch_assoc($result) {
echo '<td>' . $row['a'] . '</td>';
echo '<td>' . $row['b'] . '</td>';
echo '<td>' . $row['c'] . '</td>';
}
Into something like:
$SqlText = 'SELECT a, b, c FROM table WHERE x=y';
if (!$result = mssqli_query($db, $SqlText) {
die('Error');
}
while ($row = mssqli_fetch_assoc($result) {
echo '<td>' . $row['a'] . '</td>';
echo '<td>' . $row['b'] . '</td>';
echo '<td>' . $row['c'] . '</td>';
}
Besides, as you can see, I was using the old mssql_query code which is not even supported in the newer versions of PHP. Is there at least a tool that could change my code from mssql_query into the new version of sqlserv_query type of commands?
Any help greatly appreciated.
mssqli_queryshould bemysqli_queryand I don't understand why do you want to replacemssql_querywithsqlserv_query. Wasn't the goal to replace SQLServer with MySQL?!