Renlok Posted January 16, 2007 Share Posted January 16, 2007 i have some check which are spose to run before entering data into a data base but none of them work if you run it it will just return with an error.thanks in advance for any help.[code]<?phpinclude("/home/renlok/public_html/roe/includes/header.php"); $guildname = $_POST['name']; $guilddesc = $_POST['description']; $guildprivate = $_POST['private']; $guildlocation = $_POST['location']; $guildowner = $row['username']; $guildownerid = $row['id']; $sqlname = mysql_query("SELECT * FROM guild WHERE guildname='$guildname'") or die("error1".mysql_error()); $namecheck = mysql_num_rows($sqlname) or die("error1".mysql_error()); if($namecheck > 0) { echo "Name has already been taken"; exit; } $ownercheck = mysql_num_rows(mysql_query("SELECT * FROM guild WHERE owner='$guildowner'")) or die("error2".mysql_error()); if($ownercheck > 0) { echo "You already own a guild has already been taken"; exit; } $guildcheck = mysql_num_rows(mysql_query("SELCET * FROM guildmembers WHERE userid='$guildownerid'")) or die("error3".mysql_error()); if($guildcheck > 0) { echo "Your already part of a guild. You must first leave that guild before setting up a new one"; exit; }[/code] Quote Link to comment https://forums.phpfreaks.com/topic/34390-multiple-entry-checks-not-working/ Share on other sites More sharing options...
HuggieBear Posted January 16, 2007 Share Posted January 16, 2007 Maybe you could tell us what the error is?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/34390-multiple-entry-checks-not-working/#findComment-161857 Share on other sites More sharing options...
Renlok Posted January 16, 2007 Author Share Posted January 16, 2007 it doesnt reply with an error just show error1, you delete that check and it will return with error 2 and so on so ive no idea why its not working Quote Link to comment https://forums.phpfreaks.com/topic/34390-multiple-entry-checks-not-working/#findComment-161859 Share on other sites More sharing options...
HuggieBear Posted January 16, 2007 Share Posted January 16, 2007 OK, It's returning error1 because that's what you've told it to return...[code]$sqlname = mysql_query("SELECT * FROM guild WHERE guildname='$guildname'") or die("error1".mysql_error());[/code]It means that the call to mysql_query() is failing. I'm assuming that header.php includes your database connect code. If it does, can you post it here (but replace the username and password with asterisks).RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/34390-multiple-entry-checks-not-working/#findComment-161865 Share on other sites More sharing options...
Renlok Posted January 16, 2007 Author Share Posted January 16, 2007 yeah it urm here it is[code]include("config.php");// connect to the mysql server$link = mysql_connect($server, $db_user, $db_pass)or die ("Could not connect to mysql because ".mysql_error());// select the databasemysql_select_db($database)or die ("Could not select database because ".mysql_error());[/code] Quote Link to comment https://forums.phpfreaks.com/topic/34390-multiple-entry-checks-not-working/#findComment-161867 Share on other sites More sharing options...
HuggieBear Posted January 16, 2007 Share Posted January 16, 2007 OK, well they're coded to output errors if they encounter a problem, so that looks OK. So it's not outputting the error from mysql_error()?Huggie Quote Link to comment https://forums.phpfreaks.com/topic/34390-multiple-entry-checks-not-working/#findComment-161875 Share on other sites More sharing options...
Renlok Posted January 16, 2007 Author Share Posted January 16, 2007 no just the error1 part Quote Link to comment https://forums.phpfreaks.com/topic/34390-multiple-entry-checks-not-working/#findComment-161885 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.