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.