php XAMPP Fatal error: Uncaught Error: Call to undefined function mysql_connect()

You probably have a php7 in XAMPP Please use PDO.
mysql_* functions have been removed in PHP 7
You can use

mysqli_connect($mysql_hostname , $mysql_username)

instead of

mysql_connect($mysql_hostname , $mysql_username)

 

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\ .php:13
Stack trace: #0 C:\xampp\htdocs\chat\index.php(2): include() #1 {main} thrown in C:\xampp\htdocs\chat\config.php on line 13

PHP Upload and Rename File

I have a html upload form here, What is does is displays a browse button so users can upload files to my site, what I want them to be able to do is completely rename the file that they are uploading once they upload it to my site
Html file upload

<form action="" enctype="multipart/form-data" method="post">
 <input id="file" name="file" type="file" />
 <input id="Submit" name="submit" type="submit" value="Submit" />
 </form>

PHP File

<?php
// Upload and Rename File
if (isset($_POST['submit']))
{
 $filename = $_FILES["file"]["name"];
 $file_basename = substr($filename, 0, strripos($filename, '.')); // get file extention
 $file_ext = substr($filename, strripos($filename, '.')); // get file name
 $filesize = $_FILES["file"]["size"];
 $allowed_file_types = array('.doc','.docx','.rtf','.pdf');
if (in_array($file_ext,$allowed_file_types) && ($filesize < 200000))
 {
 // Rename file
 $newfilename = md5($file_basename) . $file_ext;
 if (file_exists("upload/" . $newfilename))
 {
 // file already exists error
 echo "You have already uploaded this file.";
 }
 else
 {
 move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $newfilename);
 echo "File uploaded successfully.";
 }
 }
 elseif (empty($file_basename))
 {
 // file selection error
 echo "Please select a file to upload.";
 }
 elseif ($filesize > 200000)
 {
 // file size error
 echo "The file you are trying to upload is too large.";
 }
 else
 {
 // file type error
 echo "Only these file typs are allowed for upload: " . implode(', ',$allowed_file_types);
 unlink($_FILES["file"]["tmp_name"]);
 }
}
?>

PHP Syllabus for self learners

  1. PHP Basics
    1. How PHP Works
    2. The php.ini File
    3. Basic PHP Syntax
      1. PHP Tags
      2. PHP Statements and Whitespace
      3. Comments
      4. PHP Functions
      5. Hello World!
    4. Variables
      1. Variable Types
      2. Variable Names (Identifiers
      3. Type Strength
      4. Hello Variables!
      5. Variable Scope
      6. Superglobals
      7. Constants
      8. Variable-Testing and Manipulation Functions
    5. PHP Operators
    6. Creating Dynamic Pages
    7. Single Quotes vs. Double Quotes
    8. Howdy World!
  2. Flow Control
    1. Conditional Processing
      1. If Conditions
    2. Loops
      1. while
      2. do…while
      3. for
      4. break and continue
  3. Arrays
    1. Enumerated Arrays
      1. Initializing Arrays
      2. Appending to an Array
      3. Reading from Arrays
      4. Looping through Arrays
    2. Associative Arrays
      1. Initializing Associative Arrays
      2. Reading from Associative Arrays
      3. Looping through Associative Arrays
      4. Superglobal Arrays
    3. Two-dimensional Arrays
      1. Reading from Two-dimensional Arrays
      2. Looping through Two-dimensional Arrays
    4. Array Manipulation Functions
  4. PHP and HTML Forms
    1. HTML Forms
      1. How HTML Forms Work
      2. A Sample HTML Form
      3. Form Variables
  5. String Manipulation
    1. Formatting Strings
      1. Concatenation
      2. String Manipulation Functions
      3. Examples of String Functions
    2. Magic Quotes
      1. magic_quotes_gpc
      2. magic_quotes_runtime
      3. Recommendation on Magic Quotes
  6. Reusing Code and Writing Functions
    1. Including Files
      1. require
      2. require_once
      3. auto_prepend_file and auto_append_file
    2. User Functions
      1. Defining and Calling Functions
      2. Default Values
      3. Variable Scope
      4. By Reference vs. By Value
    3. Form Processing
      1. Code Organization
  7. Simple SELECTs
    1. Introduction to the Northwind Database
    2. Some Basics
      1. Comments
      2. Whitespace and Semi-colons
      3. Case Sensitivity
    3. SELECTing All Columns in All Rows
    4. SELECTing Specific Columns
    5. Sorting Records
      1. Sorting By a Single Column
      2. Sorting By Multiple Columns
      3. Sorting By Column Position
      4. Ascending and Descending Sorts
    6. The WHERE Clause and Operator Symbols
      1. Checking for Equality
      2. Checking for Inequality
      3. Checking for Greater or Less Than
      4. Checking for NULL
      5. WHERE and ORDER BY
    7. The WHERE Clause and Operator Words
      1. The BETWEEN Operator
      2. The IN Operator
      3. The LIKE Operator
      4. The NOT Operator
    8. Checking Multiple Conditions
      1. AND
      2. OR
      3. Order of Evaluation
  8. Subqueries, Joins and Unions
    1. Subqueries
    2. Joins
      1. Table Aliases
      2. Multi-table Joins
    3. Outer Joins
    4. Unions
      1. UNION ALL
      2. UNION Rules
  9. Inserting, Updating and Deleting Records
    1. INSERT
    2. UPDATE
    3. DELETE
  10. Managing Data
    1. Querying a Database
      1. mysqli() Overview
      2. mysqli Methods and Properties
      3. Inserting and Updating Records
      4. mysqli Prepared Statements
  11. MDB2
    1. Advantages and Disadvantages of MDB2
      1. Why use a database abstraction layer?
      2. When not to use a database abstraction layer?
    2. Using MDB2
  12. Authentication with PHP and SQL
    1. A Database-less Login Form
  13. Regular Expressions
    1. Perl-compatible Regular Expression Functions
      1. preg_match()
      2. preg_replace()
      3. Regular Expression Tester
    2. Regular Expression Syntax
      1. Start and End ( ^ $ )
      2. Number of Occurrences ( ? + * {} )
      3. Common Characters ( . \d \D \w \W \s \S )
      4. Grouping ( [] )
      5. Negation ( ^ )
      6. Subpatterns ( () )
      7. Alternatives ( | )
      8. Escape Character ( \ )
    3. Form Validation Functions with Regular Expressions
  14. Session Control and Cookies
    1. Sessions
      1. Configuring Sessions
      2. Session Functions
    2. Cookies
  15. Sending Email with PHP
    1. mail()
      1. Shortcomings of mail()
    2. PHPMailer
  16. File System Management
    1. Opening a File
      1. fopen()
    2. Reading from a File
      1. fgets()
    3. Writing to a File
      1. fwrite()
    4. File Locking
      1. flock()
    5. Uploading Files via an HTML Form
    6. Getting File Information
    7. More File Functions
    8. Directory Functions
      1. Getting a Directory Listing