Jump to content

Bare Minimum Query For Checking if a value exists?


limitphp

Recommended Posts

I want to check to see if a songID exists in a playlist.

 

What would be the bare minimum way of doing it (least resources)?

this is what I am doing so far:

$querySong = "SELECT COUNT(id) FROM playlist_songs WHERE songID = '$songID' AND playlistID = '$playlistID'";
$resultSong = mysql_query($querySong) or die (mysql_error());
$flagSong = mysql_result($resultSong ,0);
if ($flagSong==1)
  //song Exists


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.