maxudaskin Posted July 11, 2007 Share Posted July 11, 2007 How would I compare $pid to data in the bring back 0 for not match and 1 for match? $hostname_LeadHost = "***"; $database_LeadHost = "***"; $username_LeadHost = "***"; $password_LeadHost = "***"; $LeadHost = mysql_pconnect($hostname_LeadHost, $username_LeadHost, $password_LeadHost) or trigger_error(mysql_error(),E_USER_ERROR); $id = $_GET["apps"]; /* Ignore */ $hub = $_GET["hub"]; $huba = $hub/1000; /* Ignore */ function assignpid() { $rand = rand(001,999); $pid = $hub+$rand; $result = mysql_query("SELECT pid FROM `users` WHERE `pid`='{$pid}'"); } Quote Link to comment Share on other sites More sharing options...
btherl Posted July 11, 2007 Share Posted July 11, 2007 I'm not sure I understand your question, but I think you need this: if (mysql_num_rows($result) == 1) { print "It already exists!"; } else { print "It doesn't exist yet!"; } This assumes that pid is unique in your table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.