Questions about database connection

Source: Internet
Author: User
Questions about database connection $ A = mysql_connect ("Wagner. 0.0.1", "root", "123456 ");
Mysql_select_db ("myweb", $ );
Mysql_query ("set character set 'utf8 '");
$ SQL = "select * from 'test' limit 1 ";
$ Query = mysql_query ($ SQL, $ );
$ Data = mysql_fetch_array ($ query );
Var_dump ($ data );
Echo 111;
?>
It's okay to open it directly in a browser. why is an error reported when you open it in cmd php?


Reply to discussion (solution)

Cli and web use different php. ini
Php. ini in cli mode? Face? Yes ?? Php mysql? Exhibition.

Find the php. ini used in the cli, and then extend = php_mysql.dll to the front. remove it. what is the weight? Server? You can.

Find out which cli is used? Php. ini
Yes
Phpinfo ();
?>
Save? Phpinfo. php
Then? Line
Php phpinfo. php
In? Find Loaded_Configuration File => 'xxxx'

Xxxx is the php. ini path used ?.

I printed it. I cannot find Loaded_Configuration File. my name is win7.

Php -- ini

Loaded Configuration File => 'xxxx'
?? ?.

Loaded Configuration File => 'xxxx'
?? ?.


Not found under win7

Php -- ini
Put? Outbound? Outbound? Look

Php -- ini
Put? Outbound? Outbound? Look


Oh, I used to print it out with php -- ini. thank you very much. It has been solved. close the post.

Php -- ini
Put? Outbound? Outbound? Look

Well, it makes sense .. That's what I think.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.