Thanks a lot for the help. I was actually trying to figure it out myself and then you posted. Helped me out a lot. I got it all up and now it's spitting out an error.
Here's the code after I edited the UPDATE piece...
foreach ($lines as $line_num => $line)
{
$pieces = explode("|", $line);
$query = "SELECT * FROM inv WHERE anum=$pieces[1] AND pon=$pieces[4] AND rnu=$pieces[5]";
$existing_record = mysql_query($query);
// if record exists already, then do an UPDATE
if(mysql_num_rows($existing_record)){
$existing_record = mysql_fetch_array($existing_record);
// update
$query = "UPDATE inv SET client = '$pieces[0]', qnty = '$pieces[2]', uom = '$pieces[3]', des = '$pieces[6]', ware = '$pieces[7]', posted = '$posted' WHERE invID='" . $existing_record["invID"] . "'";
mysql_query($query);
}
// otherwise, record does not exist - do an INSERT
else{
$query = "INSERT INTO inv (client, anum, qnty, uom, pon, rnu, des, ware, posted)
VALUES('$pieces[0]', '$pieces[1]', '$pieces[2]', '$pieces[3]', '$pieces[4]', '$pieces[5]', '$pieces[6]', '$pieces[7]', $posted)";
// Execute Query
$result = @mysql_query($query) or die ("Error: $query" . mysql_error());
}
}
And here's the error I'm receiving at the moment from it.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/evanbart/public_html/test.php on line 45
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/evanbart/public_html/test.php on line 45
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/evanbart/public_html/test.php on line 45
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/evanbart/public_html/test.php on line 45
Got any clues on how I could fix that? Thanks again for your all your help!