Is optimization possible?

admin

Administrator
Staff member
Here is a simple code snippet ..

$sql = "SELECT links_id FROM company_links WHERE level_row = '$level_row' AND link_description = '$link_description'";
$links_check = mysql_query($sql);
$links_check = mysql_fetch_row($links_check);

if (($links_check[0] == "0") OR ($links_check[0] == "")) {
$sql = "INSERT INTO company_links(link_description, link_url, created_date, level_row, active) values('$link_description', '$link_url', '$now();', '$level_row', 'Y')";
mysql_query($sql);
}


As this query is part of a flat file that I'm looping through, I need to do it upwards of 20,000 times :-(

Can this part of the code be optimized so it's only 1 query?

Thanks in advance for any help given.
 
Back
Top