I am trying to set up an online RSVP for my upcoming wedding. Im trying to adapt my code from using SQLServer to mySQL through GoDaddy's hosting. In my database connection file, I have the following code:
<?php
// function to connect to the database
function dbConnect()
{
    $serverName = 'localhost';
    $uName = 'codytaylorbrown';
    $pWord = 'G0Braves!';
    $db = 'BrownWedding';
    try
    {
        //instantiate a PDO object and set connection properties
        $conn = mysql_connect($serverName , $uName , $pWord );
mysql_select_db($db, $conn);
        //return connection object
        return $conn;
    }
    // if connection fails
    catch (PDOException $e)
    {
        die('Connection failed: ' . $e->getMessage());
    }
}
//method to execute a query - the SQL statement to be executed, is passed to it
function executeQuery($query)
{
    // call the dbConnect function
    $conn = dbConnect();
    try
    {
        // execute query and assign results to a PDOStatement object
        $stmt = $conn->query($query);
        do
        {
            if ($stmt->columnCount() > 0)  // if rows with columns are returned
            {
                $results = $stmt->fetchAll(PDO::FETCH_ASSOC);  //retreive the rows as an associative array
            }
        } while ($stmt->nextRowset());  // if multiple queries are executed, repeat the process for each set of results
     die;
//call dbDisconnect() method to close the connection
        dbDisconnect($conn);
        return $results;
    }
    catch (PDOException $e)
    {
        //if execution fails
        dbDisconnect($conn);
        die ('Query failed: ' . $e->getMessage());
    }
}
function dbDisconnect($conn)
{
    // closes the specfied connection and releases associated resources
    $conn = null;
}
?>
When I open my RSVP.php page, which contains a form and references another php file to post the results to the database, I get the error
Fatal error: Call to a member function query() on a non-object in /home/ctbrown24/public_html/DBConnect.php on line 50
I'm not extremely well versed in php and am building my wedding website as a way to learn, so any help with this would be appreciated. TIA!
 
    