Jump to content

Ph0enix

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Everything posted by Ph0enix

  1. No i just want to insert the data into my database and then if it has been inserted then i get an output saying "You have sucessfully registered a clan!"
  2. Erm, no cause i get the output SELECT * FROM clans WHERE clantag='Test' OR clanname='Test'. What do i have to change to make it insert the info and update the users profile?
  3. The output is SELECT * FROM clans WHERE clantag='Test' OR clanname='Test' again.  :-\
  4. Well before i tried andys code i used redarrow's code and got the output SELECT * FROM clans WHERE clantag='test' OR clanname='test' Then when i tried andys code i got no output, and nothing happened with my databases. Now iv tried redarrow's code and i get the output.. SELECT * FROM clans WHERE clantag='test' OR clanname='test' Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\league\clanck.php on line 29
  5. Hi i tried your code andy, and i dont get any output and nothing is submitted into the database. =/
  6. Now the output is.. SELECT * FROM clans WHERE clantag='test' OR clanname='test'
  7. Ok got rid of that. It hasn't changed though.
  8. After changing that the warning has gone.. and the output is now.. SELECT * FROM clans WHERE clantag='test' OR clanname=''
  9. Well my code i started with is the one right at the start. The code i have now is [code] <?php session_start(); include "connect.php"; $username=$_SESSION['username']=$username; $username=($_POST['username']); $clantag=($_POST['clantag']); $clanname=($_post['clanname']); $clansite=($_post['clansite']); $username=addslashes($username); $clantag=addslashes($clantag); $clanname=addslashes($clanname); $clansite=addslashes($clansite); if (($_POST['clanname']=="") || ($_POST['clantag']=="")) {   echo "Clan Tag and Clan Name are required fields."; }else{ $query = "SELECT * FROM clans WHERE clantag='$clantag' OR clanname='$clanname'"; echo $query; $result=mysql_query(query); while($row=mysql_fetch_assoc($result)){ if($row['clanname']==1) { echo "The Clan Tag or Clan Name you have chosen are allready in use."; }else{ $add_clan="INSERT INTO clans (clantag, clanname, clansite) VALUES ('$clantag', '$clanname', '$clansite')"; mysql_query($add_clan) or die(mysql_error()); $update_name="UPDATE users SET clanname='$clanname' WHERE username='$username'"; $result1=mysql_query($update_name) or die(mysql_error()); $update_tag="UPDATE users SET clantag='$clantag' WHERE username='$username'"; $result2=mysql_query($update_tag) or die(mysql_error()); $update_rank="UPDATE users SET rank='Leader' WHERE username='$username'"; $result3=mysql_query($update_rank) or die(mysql_error()); echo "You have sucessfully registered a clan"; }  } } ?> [/code] I'm not sure if this code is doing the same as what the first bit of code was trying to do..
  10. Now the output is.. SELECT * FROM clans WHERE clantag='test' OR clanname = '' Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\league\clanck.php on line 31
  11. No i get an error saying "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\league\clanck.php on line 30" :s
  12. lol! Now instead of the clansite being the thing that is put it, the clan tag is being put in, and nothing else. =/ But now i get this... "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\league\clanck.php on line 31 You have sucessfully registered a clan"  Line 31 is.. $rows = mysql_num_rows($result); Is there anything else i can try? Thanks for your help.
  13. Nope it still isnt working =/
  14. Hi, yes i have another very annoying error in my script. This is my script.. [code] <?php session_start(); include "connect.php"; $username= $_SESSION['username']; if ($_POST[clanname]="" OR $_POST['clantag']="") {   echo "Clan Tag and Clan Name are required fields."; }else{ $result = mysql_query("SELECT * FROM clans WHERE clantag = '$_POST[clantag]' OR clanname = '$_POST[clanname]'"); $rows = mysql_num_rows($result); if ($rows > 0) {   echo "The Clan Tag or Clan Name you have chosen are allready in use."; }else{ $add_clan = ("INSERT INTO clans (clantag, clanname, clansite) VALUES ('$_POST[clantag]', '$_POST[clanname]', '$_POST[clansite]')"); mysql_query($add_clan) or die(mysql_error()); $update_name = ("UPDATE users SET clanname = '$_POST[clanname]' WHERE username = '$username' "); mysql_query($update_name) or die(mysql_error()); $update_tag = ("UPDATE users SET clantag = '$_POST[clantag]' WHERE username = '$username' "); mysql_query($update_tag) or die(mysql_error()); $update_rank = ("UPDATE users SET rank = 'Leader' WHERE username = '$username' "); mysql_query($update_rank) or die(mysql_error()); echo "You have sucessfully registered a clan"; }  } ?> [/code] Now the annoything is that it says "You have successfully registered a clan" and a new row has been added in the database, but only the name of the website is submitted into it. Both the clanname and clantag fields are empty. Its sooooo annoying. Please help me.. Thanks Max
  15. Try doing this.. [code] if ($ratings[votes]===0) { echo "0"; }else { if ($current = $ratings[total] / $ratings[votes] === 0) { echo "Current Rating: " . ($current) . "<br>"; } } [/code]
  16. I tried them both and the first one says "That you are associated with a clan" whether the field is empty or not. The second one works.. YES!!! Finally. Thank you both for helping me. I really appreciate it. :D
  17. Argh!! Still doesn't work  :( I was thinking, should i set the default for the column clanname to 1 and then check the field to see if it is equal to 1, and if it is then they are not in a clan. If i should try this how would i do it?  :-[ (thanks for all the help your giving me tomfmason) Thanks Max
  18. Hi, thanks tomfmason. Nope, still doesnt work. Grrr! This is soooo annoying. Is there anything else i can try? Thanks Max
  19. Hi, thanks tomfmason but it still doesn't work :( Now if the user is in a clan or not, the output is always "You are allready in a clan". Any other suggestions? Thanks Max
  20. Hi, thanks for your fast reply. The first part of the script works fine its just the next bit.. $username = $_SESSION['username']; $result = mysql_fetch_array(mysql_query("SELECT clanname FROM users WHERE username = '$username'")); if (($result['username'] != "")) {   echo "You are allready in a clan."; even if the user is in a clan the form still shows. But if they are in a clan i want a message to come up saying "you are allready in a clan" and then thats it. Thanks Max
  21. Hi, im creating a league script and i have come across a problem. On the page where people are able to register clans, i want to check to see if they are allready in a clan. This is my script. [code]<?php session_start(); include "connect.php"; if (empty($_SESSION['username'])) { echo "You must be logged in to access this page. <a href='login.php'>Click here</a> to login."; }else{ $username = $_SESSION['username']; $result = mysql_fetch_array(mysql_query("SELECT clanname FROM users WHERE username = '$username'")); if (($result['username'] != "")) {   echo "You are allready in a clan."; }else{ echo "<form action='clanck.php' method='POST'> <table align='center' border='0' cellspacing='0'> <tr> <td>Clan Tag:</td> <td><input type='text' name='clantag'></td> </tr> <tr> <td>Clan Name:</td> <td><input type='text' name='clanname'> </tr> <tr> <td>Clan Site:</td> <td><input type='text' name='clansite'></td> </tr> <tr> <td><input type='submit' value='Register Clan'></td> </tr> </table> </form>"; } } ?> [/code] The first bit works, so if they are not logged in then they cant access the page. But the next bit doesnt. I dont get any error, but the form is always shown even if they are in a clan. Can someone help me please? Thanks Max
  22. WAMP5 is a very good program and its what i use. If you want to install it and see how to configure it. Go to www.phpvideotutorials.com and look at the tuts. You will learn a lot from this site. ;)
  23. Ok then. Thanks for your help Stickman :)
×
×
  • 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.