Script Doesn't Work

I made a PHP script and it has been working for a long time. When I run the script today, it doesn’t work. Here is the script.


<?php
session_start();
require("includes/userInfo.php");
if(!isset($_SESSION['id'])){
	header('Location: '. $root . $home);
}
?>

Here is userInfo.php


<?php
require("includes/redirect.php");
require("includes/connect.php");
$query = mysql_query(
    sprintf(
        "SELECT ID,Username,Passwd,Email,Name,Gender,Location,URL,Bio FROM sq_users WHERE ID = '%s'",
        mysql_real_escape_string($_SESSION['id'])
    )
);	

$row = mysql_fetch_row($query);

$id = $row[0];
$uname = $row[1];
$pass = $row[2];
$email = $row[3];
$name = $row[4];
$gender = $row[5];
$loc = $row[6];
$url = $row[7];
$bio = $row[8];

mysql_close($con);
?>

Here is redirect.php


<?php
//Place all of you redirects in this file
//Change this variable to the root of you site. Ex. http://bsatroop878.org/, http://localhost/social/ 
//Make sure you end with a trailing slash
$root = "http://localhost/social/";

//File directs
$no_error = "regaction.php?no_error=1";
$email_use = "regaction.php?email_use=1";
$name_use = "regaction.php?name_exists=1";
$log_fail = "login.php?log_fail=1";
$logged = "login.php?logged=1";
$valid = "login.php?valid=1";
$up_fail = "proact.php?up_fail=1";
$update = "proact.php?update=1";
$u_exists = "setact.php?u_exists=1"
$home = "home.php";
$logOut = "index.php";
?>

Here is connect.php.


<?php
$host="localhost";
$username="root";
$password="temple01";
$db_name="socialquests";

$con = mysql_connect("$host", "$username", "$password"); 
if(!$con)
	{
		die('Could not connect:'. mysql_error());
	}
	
mysql_select_db("$db_name", "$con") or die('Could not connect'. mysql_error());
?>

When I take the require function out of the first script, it works. When I take “redirect.php” out of “userInfo.php”, it can’t connect (it dies that, but no error message shows up), and when I take out “connect.php” the page doesn’t load.

Thanks for the help.

I took the require function out of the first script, but when I try to log in, it dies the second error message in “connect.php” (but still no mysql error message.)