Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Notice: Undefined variable: conn in C:wampwwwphpfunctions.php on line 9
- Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:wampwwwphpfunctions.php on line 9
- Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:wampwwwphpfunctions.php on line 10
- <?php
- session_start();
- require_once 'connect.php';
- include 'functions.php';
- getData();
- ?>
- <?php
- $servername = "localhost";
- $username = "username";
- $password = "password";
- $conn = mysqli_connect("$servername","$username","$password") or die ("could not connect to mysql");
- mysqli_select_db($conn,"php") or die ("Database not found.");
- function kill(){
- mysqli_close($conn);
- header('Location:/login');
- }
- ?>
- <?php
- require_once 'connect.php';
- function getData() {
- if(isset($_SESSION['username'])){
- $username = $_SESSION['username'];
- $query = "SELECT first_name FROM users WHERE user_name = '$username'";
- $result = mysqli_query($conn, $query);
- $userdata=mysqli_fetch_array($result);
- echo $userdata["first_name"];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement