Hello all,
When you do "inset select function" what do you think is the best way to get a record count? Also how would you do the if function with insert select function that you think is best
Based on the answer of 1 or 0 tells my script what to do.
if you want to see my code I can attach it. its 90ish lines but here is the area withthe insert select:
$query_is = "INSERT INTO irs_query SELECT * FROM irs_rawdata WHERE (EIN = '$fin' AND EIN = 'abc')";
$result_is = mysql_query($query_is) OR die("Sorry was unable to insert and select the records from the db table irs_rawdata! <br />" . mysql_error());
$count_4_is = mysql_affected_rows() OR die("Was unable to get number of rows");
$query_d = "DELETE FROM irs_rawdata WHERE EIN = '$fin'";
$result_d = mysql_query($query_d) OR die("Was unable delete ". $fin ." from the db table irs_rawdata! <br />" . mysql_error());
// $count_4_d = mysql_affected_rows() OR die("Was unable to get number of rows");
if ($count_4_is == 0 )
{
echo "The record did\'t match the criteria, we have added it to the \"block\" table and deleted it from \"irs_query\"!<br />";
$query_i = "INSERT INTO block (fin, who_blocked) VALUES ('$fin', 'S-123456789')";
$result_i = mysql_query($query_i) OR die("Sorry was unable to insert ".$fin." into the database table allowed! <br />" . mysql_error());
$query_d = "DELETE FROM irs_rawdata WHERE EIN ='$fin'";
$result_d = mysql_query($query_d) OR die("Was unable to delete ".$fin." from the db table irs_rawdata! <br />" . mysql_error());
}
Sincerely,
Christopher