I'm getting this error and have no clues why:
Fatal error: Call to a member function bind_param() on a non-object
$string = file_get_contents($url, false, $context);
$xml    = new SimpleXMLElement($string);
if ($stmt->prepare("INSERT INTO table (id, filePointer, amount, description) 
                        VALUES (?, ?, ?, ?)"))
{
    foreach ($xml->machine as $machine) 
    {
        $stmt->bind_param('ssss', $machine->id, $machine->images->image->filePointer, $machine->advertised_price->amount, $machine->description);
        // Execute the query
        $stmt->execute();
        $stmt->close();
    }
}
Here is how I'm calling the table up:
//Create table
$create_table =
'CREATE TABLE IF NOT EXISTS table  
(
    id INT NOT NULL,
    filePointer TEXT NOT NULL,
    amount INT NOT NULL,
    description TEXT NOT NULL
    PRIMARY KEY(id)
)';
$create_tbl = $db->query($create_table);
if ($create_table)
{
    echo "Table has been created";
} 
else 
{
        echo "error!!";  
}
Previously I was making my table in MyPHPAdmin. When I run this and then check my database, it is not creating a table OR updating it. I have checked to make sure it is connecting to the database and as far as I can tell it is working.
My new INSERT INTO code:
$stmt =  $db->stmt_init();
if ($stmt->prepare("INSERT INTO table (id, filePointer, amount, description) 
                        VALUES (?, ?, ?, ?)"))
{
    $id          = 0;
    $filePointer = '';
    $amount      = 0;
    $description = '';
    $stmt->bind_param('isis', $id, $filePointer, $amount, $description);
    foreach ($xml->machine as $machine) 
    {
        $id          = $machine->id;
        $filePointer = $machine->images->image->filePointer;
        $amount      = $machine->advertised_price->amount;
        $description = $machine->description;
        if (!$stmt->execute())
        { 
            echo "error : ".$id."<br />\n";
            break;
        }     
    }
    $stmt->close();
}
 
     
     
    