Jump to content

check if item already exists


pouncer

Recommended Posts

/*
 * 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

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;

}
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.