pouncer Posted April 9, 2009 Share Posted April 9, 2009 /* * Check if an RSS Feed link already exists in the database. */ function rssExists($link, $rss_table) { $check_link = mysql_query("SELECT * FROM `$rss_table` where rsslink='$link'") or die("Query error: <b>". mysql_error()); $rows = mysql_num_rows($check_link); if ($rows == 1) return true; else return false; } Is it possible to do it without using a query? Link to comment https://forums.phpfreaks.com/topic/153309-check-if-item-already-exists/ Share on other sites More sharing options...
redarrow Posted April 9, 2009 Share Posted April 9, 2009 what you mean if it info in the database then you need a query ha Link to comment https://forums.phpfreaks.com/topic/153309-check-if-item-already-exists/#findComment-805407 Share on other sites More sharing options...
pouncer Posted April 9, 2009 Author Share Posted April 9, 2009 just trying to make the code smaller i guess Link to comment https://forums.phpfreaks.com/topic/153309-check-if-item-already-exists/#findComment-805440 Share on other sites More sharing options...
redarrow Posted April 9, 2009 Share Posted April 9, 2009 what about this. added limit 1, might work. <?php /* * Check if an RSS Feed link already exists in the database. */ function rssExists($link, $rss_table) { $check_link = mysql_query("SELECT * FROM `$rss_table` where rsslink='$link' LIMIT 1") or die("Query error: <b>". mysql_error()); if(mysql_num_rows($check_link)){ return true; }else{ return false; } } ?> Link to comment https://forums.phpfreaks.com/topic/153309-check-if-item-already-exists/#findComment-805449 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.