Basically I have a php script which calls an external XML file
it then inserts certain data from the xml file into the mysql db inside a foreach loop
However when I check the database its empty
What am I doing wrong
The xml contains the following structure
<jobs>
    <job>
        <jobref>987654321</jobref>
        <title>TITLE HERE</title>
        <url>
        URL HERE
        </url>
        <salary>£85 - £105/day benifits</salary>
        <location>LOCATION</location>
        <description>desc</description>
        <category>CAT HERE</category>
    </job>
    <job>
        <jobref>123456789</jobref>
        <titleTITLE HERE</title>
        <url>
        URL HERE
        </url>
        <salary>£85 - £105/day benifits</salary>
        <location>LOCATION</location>
        <description>desc</description>
        <category>CAT</category>
    </job>
</jobs>
Below is the PHP code
<?php
    $dbu = 'user';
    $dbp = 'pass';
    $dbh = 'localhost';
    $dbn = 'dbname';
    $dbc = mysql_pconnect($dbh,$dbu,$dbp);
    // Get XML Feed
    $startPage = $_GET['page'];
    $perPage = 3000;
    $currentRecord = 0;
    $xml = simplexml_load_file("urlhere");
    $jobs = $xml->xpath("/jobs/job");
    foreach ($jobs as $job)
    {
        mysql_select_db($dbn,$dbc);
        $query = mysql_query("INSERT INTO `listings` (`jobref`,`title`,`url`,`salary`,`location`,`description`,`category`) VALUES ('$job->jobref','$job->title','$job->salary','$job->location','$job->description','$job->category')",$dbc);
        echo "$job->jobref Added <br>";
    }
?>
It displays :
120239811 Added 
201909016 Added 
202482907 Added 
when i run the script so its parsing the xml file but its not actually inserting the data
Any help would be great because I'm on a very tight timeframe to finish this Thanks in advance
** EDIT BELOW ** NEW code below
<?php
        $startPage = 1;
        $perPage = 3000;
        $currentRecord = 0;
        $xml = simplexml_load_file("urlhere");
        $jobs = $xml->xpath("/jobs/job");
        mysql_select_db($dbn,$dbc);
        foreach ($jobs as $job)
        {
        $currentRecord += 1;
         if($currentRecord > ($startPage * $perPage) && $currentRecord < ($startPage * $perPage + $perPage)){ 
        $query = mysql_query("INSERT IGNORE INTO `listings` (jobref,title,url,salary,location,description,category) VALUES ('$job->jobref','$job->title','$job->url','$job->salary','$job->location','$job->description','$job->category')",$dbc);
        if($query){
        echo "$job->jobref Added <br>";
        } else {
        echo mysql_error();
        }
        }
        }
        ?>
Its now just adding the 1st entry in the XML file
Removed IGNORE from query and added ON DUPLICATE KEY UPDATE jobref =$job->jobref+1 still same problem
 
     
    