3raser Posted June 16, 2010 Author Share Posted June 16, 2010 And I edited my post above. So my query is failing. I'm not sure how many times I need to say it, you need to SELECT a field. I'm not selecting a field, I'm just seeing if it exists. Which brings me to another point. Should I put the whole code inside the failing part, because when it fails....that means a clan with that name doesn't exist. Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072894 Share on other sites More sharing options...
3raser Posted June 16, 2010 Author Share Posted June 16, 2010 Can you please make it so there is no edit limit on posts? I always go to edit and the limit us up. I think this is the answer to the problem. I just keep getting this parse error: Parse error: parse error in C:\wamp\www\project11\register_clan.php on line 28 for if(!$clan_name) { echo "Enter in a clan name: <form action='register_clan.php' method='POST'><input type='text' name='clan'><input type='submit' value='Register Clan'></form>"; } else { if ($get_other = mysql_query("SELECT FROM clans WHERE clan_name='$clan_name'")) { $check = mysql_num_rows($get_other); } else { echo "Yes."; } else { echo "No."; } } } Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072899 Share on other sites More sharing options...
KevinM1 Posted June 16, 2010 Share Posted June 16, 2010 And I edited my post above. So my query is failing. I'm not sure how many times I need to say it, you need to SELECT a field. I'm not selecting a field, I'm just seeing if it exists. In order to see if a field exists, you need to select it. This is SQL 101. Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072901 Share on other sites More sharing options...
3raser Posted June 16, 2010 Author Share Posted June 16, 2010 Bump Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072923 Share on other sites More sharing options...
trq Posted June 16, 2010 Share Posted June 16, 2010 See here http://dev.mysql.com/doc/refman/5.1/en/select.html. I'm honestly over repeating myself. Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072926 Share on other sites More sharing options...
3raser Posted June 16, 2010 Author Share Posted June 16, 2010 See here http://dev.mysql.com/doc/refman/5.1/en/select.html. I'm honestly over repeating myself. WHAT?! REPEATING YOURSELF?! I've read every single one of your posts...and what I'm talking about now, my error above, is not even something we have discussed... Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072928 Share on other sites More sharing options...
trq Posted June 16, 2010 Share Posted June 16, 2010 Well then, considering you only posted 18 lines of code, I can't see any parse error on line 28. Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072931 Share on other sites More sharing options...
3raser Posted June 16, 2010 Author Share Posted June 16, 2010 <?php session_start(); $session = $_SESSION['user']; $mysql_host = "localhost"; $mysql_username = "root"; $mysql_password = ""; $mysql_database = "project11"; mysql_connect($mysql_host, $mysql_username, $mysql_password); mysql_select_db($mysql_database); if(!$session) { echo "Please <a href='login.php'>login</a> first, or <a href='index.php'>go home</a>."; } else { $clan_name = $_POST['clan']; $ip = $_SERVER['REMOTE_ADDR']; $date = date("M-D-Y"); if(!$clan_name) { echo "Enter in a clan name: <form action='register_clan.php' method='POST'><input type='text' name='clan'><input type='submit' value='Register Clan'></form>"; } else { if ($get_other = mysql_query("SELECT FROM clans WHERE clan_name='$clan_name'")) { $check = mysql_num_rows($get_other); } else { echo "Yes."; } else { echo "No."; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072937 Share on other sites More sharing options...
trq Posted June 16, 2010 Share Posted June 16, 2010 <?php session_start(); $session = $_SESSION['user']; $mysql_host = "localhost"; $mysql_username = "root"; $mysql_password = ""; $mysql_database = "project11"; mysql_connect($mysql_host, $mysql_username, $mysql_password); mysql_select_db($mysql_database); if(!$session) { echo "Please <a href='login.php'>login</a> first, or <a href='index.php'>go home</a>."; } else { $clan_name = $_POST['clan']; $ip = $_SERVER['REMOTE_ADDR']; $date = date("M-D-Y"); if(!$clan_name) { echo "Enter in a clan name: <form action='register_clan.php' method='POST'><input type='text' name='clan'><input type='submit' value='Register Clan'></form>"; } else { if ($get_other = mysql_query("SELECT FROM clans WHERE clan_name='$clan_name'")) { $check = mysql_num_rows($get_other); echo "Yes."; } else { echo "No."; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072938 Share on other sites More sharing options...
3raser Posted June 16, 2010 Author Share Posted June 16, 2010 Well it doesn't work, I give up. Delete this topic if you wish. Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072942 Share on other sites More sharing options...
trq Posted June 16, 2010 Share Posted June 16, 2010 What does doesn't work mean? In the last part you still aren't selecting any field (see my link above). You then never actually check to see if your query returned any results. if ($get_other = mysql_query("SELECT clan_name FROM clans WHERE clan_name='$clan_name'")) { $check = mysql_num_rows($get_other); if ($check) { echo "Yes."; // clan already exists } else { echo "No."; // clan not found } } Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072944 Share on other sites More sharing options...
3raser Posted June 16, 2010 Author Share Posted June 16, 2010 <?php session_start(); $session = $_SESSION['user']; $mysql_host = "localhost"; $mysql_username = "root"; $mysql_password = ""; $mysql_database = "project11"; mysql_connect($mysql_host, $mysql_username, $mysql_password); mysql_select_db($mysql_database); if(!$session) { echo "Please <a href='login.php'>login</a> first, or <a href='index.php'>go home</a>."; } else { $clan_name = $_POST['clan']; $ip = $_SERVER['REMOTE_ADDR']; $date = date("M-D-Y"); if(!$clan_name) { echo "Enter in a clan name: <form action='register_clan.php' method='POST'><input type='text' name='clan'><input type='submit' value='Register Clan'></form>"; } else { if ($get_other = mysql_query("SELECT clan_name FROM clans WHERE clan_name='$clan_name'")) { $check = mysql_num_rows($get_other); if ($check) { echo "Yes."; // clan already exists } else { echo "No."; // clan not found } } } } ?> No, it doesn't work. Even when I enter in something that doesn't exist, it says no. Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072946 Share on other sites More sharing options...
trq Posted June 16, 2010 Share Posted June 16, 2010 Even when I enter in something that doesn't exist, it says no. That would be correct. Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072948 Share on other sites More sharing options...
3raser Posted June 16, 2010 Author Share Posted June 16, 2010 Dude, I appreciate it a lot. I know It could get frustrating working with me, I haven't even went to sleep....so I'm half awake and half a sleep. But I can finally mark this thread solved. Until about 15 minutes later when I run into another bug Quote Link to comment https://forums.phpfreaks.com/topic/204910-mysql_querydelete-clan_name-from-clans/page/2/#findComment-1072950 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.