user4fun Posted March 7, 2007 Share Posted March 7, 2007 include("/inc/business_main_header.inc");$strdomain = strtolower($Domain);//Checks to see if domain already exsists$link = mysql_connect("mysql", "", "") or die ("No connection"); mysql_select_db("Business") or die ("no database"); $q2 = mysql_query("SELECT * FROM Profile WHERE Domain == $strdomain"); $q3 = mysql_fetch_object($q2); if($q3->Domain == $strdomain) { die('<BR>This domain name entered as "'.$q3->Domain.'" is already in our system.');} no matter what the $domain is, it says it is in the system :-( Link to comment Share on other sites More sharing options...
vijay Posted March 7, 2007 Share Posted March 7, 2007 Hi.. change ur query following.. $qry="SELECT * FROM Profile WHERE Domain = '".$strdomain."'"; $q2 = mysql_query($qry); $q3 = mysql_fetch_object($q2); suppose this will help u..Regards,Vijay Link to comment Share on other sites More sharing options...
user4fun Posted March 7, 2007 Author Share Posted March 7, 2007 That did not do it eitheri think itis a syntax problemhere is the original code again $strdomain = strtolower($Domain); //$Domain, user input from form$q2 = mysql_query("SELECT * FROM `Profile` WHERE `Domain` = $strdomain); $q3 = mysql_fetch_object($q2); if($q3->Domain == $strdomain) { die('<BR>This domain name entered as "'.$q3->Domain.'" is already in our system.');} Link to comment Share on other sites More sharing options...
Mr_CHISOL Posted March 7, 2007 Share Posted March 7, 2007 Hi!That code isn't correct. The squery-string isn't terminated and you need single-quotes around $strdomain as Domain and $stdomains are string.Try this code, I use mysql_num_rows to see if the query returned something.If the result is empty mysql_fetch_object() returns FALSE and then you try to get the member Domain from FALSE, which shouldn't be valid.... $strdomain = strtolower($Domain);//$Domain, user input from form$q2 = mysql_query("SELECT * FROM `Profile` WHERE `Domain` = '$strdomain'");if ((mysql_num_rows($q2) == FALSE)||(mysql_num_rows($q2) > 0)) { die('<br />This domain name entered as "'.$Domain.'" is already in our system.');} (Always use small letters in tags and end "empty tags", such as br and img, with a slash)Hope that helped!Good Luck and Don't Panic! Link to comment Share on other sites More sharing options...
user4fun Posted March 7, 2007 Author Share Posted March 7, 2007 hmmmmmmgood suggestions but it still does not workRegardless of what $Domain is which becomes properly changed to $strdomainThe system always recognize it as a domain that already exsists.No matter what the entry is. Link to comment Share on other sites More sharing options...
Mr_CHISOL Posted March 7, 2007 Share Posted March 7, 2007 Add a echo mysql_error(); somewhere after the query and see if that gives you any info.Can't figure anything else out right now... Link to comment Share on other sites More sharing options...
justsomeguy Posted March 7, 2007 Share Posted March 7, 2007 Have you printed out $strdomain to figure out what you're asking it? That would be debugging step #1. Step 2 would be to print out the entire query. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now