1024programmer PHP Brother, why is my php link to the database always successful?

Brother, why is my php link to the database always successful?

Why is my php connection to the database always successful?
My environment, Windows 2008, SQL Server 2000, php5.2.17.

The code for my linked database is as follows:
<?php

echo “
\nEnter mssql
\n”;

//File containing database information
include(‘db/mssql.inc’);

//The link is successful and a link ID is returned. If it fails, FALSE is returned
$my_cOnn= mssql_connect($db_server,$db_user_name,$db_password,true);

if(! $my_conn)
{
//Equivalent to exit
die(‘Failed to connect to database!’);
}
else
{
echo “Link to SQL Server successfully!
\n”;

//Close the SQL link
mssql_close($my_conn);
}
echo “Leave mssql
\n
\n”;
?>

Among them, the file mssql.inc containing the database information, I now put the database The user and password have been changed to incorrect ones, but the link is still displayed normally.

The display is as follows:
Enter mssql
Link to SQL Server successfully!
Leave mssql

Why is this? ? ?
Thank you for your guidance, I have just started learning.

——Solution——————–
I think…that only means that your judgment conditions are reversed…that is to say, you have never successfully connected to the db so far…

Look at you What is in the error_log in php.

——Solution——————–
No Troubleshoot your browser cache

——Solution——————–
Connection It’s not turned off at all!

——Solution——————–
Okay It hurts. Someone asked why it always failed and now it always succeeds
It seems there is no problem. Before if(!$my_conn) var_dump($my_conn); look at the output.

——Solution——————–
Put
$my_cOnn= mssql_connect($db_server,$db_user_name,$db_password,true);
Change to
$my_cOnn= mssql_connect($db_server,$user,$password,true);
/>See if it’s still correct?

——Solution——————–
Certification The modification is in sql server

——Solution——————–
Halo Damn…

It’s so fun for you. mssql can set the account verification method. Pay attention to the mssql tool. I don’t remember how to do it. You can continue to tinker.

——Solution——————–
New As a SqlServer user, try it again so that you can compare and test whether it is successful or not.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/brother-why-is-my-php-link-to-the-database-always-successful-2/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索