search

Home  >  Q&A  >  body text

Where are the codes for the conn.php and functions.php files?

<?php

 require_once('conn.php'); //连接数据库

 require_once('functions.php');

 $sql = "SELECT * FROM news order by id desc";

 $info = mysql_query($sql); 

?>


为爱走天涯为爱走天涯2424 days ago1948

reply all(2)I'll reply

  • phpcn_u83868

    phpcn_u838682018-05-29 11:18:20

    <?php

    $servername = "localhost";

    $username = "root";

    $password = "root";


    // Create connection

    $conn = mysqli_connect($servername, $username, $password);

    mysqli_set_charset($conn, 'utf8' );

    mysql_select_db("article");

    // Detect connection

    if (!$conn) {

    die("Connection failed: " . mysqli_connect_error());

    }

    //echo "Connection successful";

    ?>

    The above is the content of conn.php

    functions.php I don’t know what it is. I just started learning and haven’t figured out what this file is supposed to do

    reply
    0
  • sky

    sky2018-04-12 17:59:25

    If it is not a framework, it will be in the same directory.

    There is also a problem with your database link

    reply
    0
  • Cancelreply