dsgffz2579
dsgffz2579
2016-06-17 07:41
浏览 123
已采纳

mysqli_connect()中的第四个参数是什么?

What is "forks" in mySQL

<?php  
$connect = mysqli_connect("db location","username","password", "forks") or die(mysql_error());
?>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doulan4371
    doulan4371 2016-06-17 07:42
    已采纳

    Its database name

    mysqli_connect(host,username,password,dbname,port,socket);
    

    Parameter      Description
    host           Optional. Specifies a host name or an IP address
    username       Optional. Specifies the MySQL username
    password       Optional. Specifies the MySQL password
    dbname         Optional. Specifies the default database to be used
    port           Optional. Specifies the port number to attempt to connect to the MySQL server
    socket         Optional. Specifies the socket or named pipe to be used
    

    Source: http://php.net/manual/en/function.mysqli-connect.php

    点赞 评论
  • duanfengtuo6012
    duanfengtuo6012 2016-06-17 07:43

    In your example, forks is the fourth parameter, so it is simply the name of the database. The word forks is otherwise meaningless in MySQL, and doesn't bear any relevance to the code itself.

    The parameters of the mysqli_connect() PHP function are as follows:

    1. Host
    2. Username
    3. Password
    4. Database Name
    5. Port
    6. Socket

    See the PHP Manual for the mysqli::__construct() function, of which mysqli_connect is an alias.

    点赞 评论

相关推荐