I'm parsing my pages to find all id's. What I want to do is: if the id already exists in my db then I want to update it...if not I want to insert a record. How can I go about doing that. Any help would be appreciated. Thanks!!
foreach ($url as $value)
{
$base = "http://www.mypage.com/whatever";
$getit = "".$base."$value";
$input = file_get_contents("$getit");
preg_match_all('@<a href="/whatever/([A-Za-z0-9-]+)">(.*?), (.*?)</a>@', $input, $matches);
for($i=0;$i<40;$i++)
{
$sql3 = "SELECT id from mlbplayers where id=".$matches[1][$i]."";
while ($row3 = mysql_fetch_assoc($result3))
{
$pid = $row3["id"];
}
echo "$sql3<br />";
}
}