[PHP] Account Creation Page Syntax Error menu

Shout-Out

User Tag List

Results 1 to 8 of 8
  1. #1
    tranced's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [PHP] Account Creation Page Syntax Error

    I recently used a code for a very basic account creation page from MMOwned(i would have asked the question on that thread but could not as the thread was too old) and I am getting an error that says "Parse error: syntax error, unexpected T_STRING in /home/wowrequ1/public_html/home.php on line 18"
    and after searching around on the web for a fix to this, I figure that its either that I'm using an old PHP(not completely sure what that means, but thats what other people with similar issues were told on various boards) in which case could i get help in changing into the proper php? or there is simply some small thing im missing (common ones were ";" (}) or (")) After looking through it trying several things i could not find out what was wrong, as I am fairly new to php code.
    Here is my home.php code
    PHP Code:
    <html>
        <body>
            <?php
            error_reporting
    (E_ALL);
            
    $name $_POST['username'];
            
    $pass $_POST['password'];
            
    $email $_POST['email'];
            
    $flags=0;
            if(!empty(
    $_POST['TBC'])){
                
    $flags+=8;
            }
            if(!empty(
    $_POST['WotLK'])){
                
    $flags+=24;
            }
            
    mysql_connect("ipaddress","user","password");
            
    mysql_select_db("accounts");
            if(
    mysql_num_rows(mysql_query("SELECT * FROM `accounts` WHERE `login`= '".$name."'))>0){
                   echo"
    Please Choose another Username.";
           }else{
               if(mysql_query("
    INSERT INTO accounts (loginpasswordemail,flagsVALUES('$name''$pass''$email''$flags' )")){
                   echo"
    Your Account has been created Successfully";
               }else{
                   echo"
    Please Try Again.";
               }
           }
     
           ?>
        </body>
    </html>
    Any help is appreciated!
    Thanks!

    [PHP] Account Creation Page Syntax Error
  2. #2
    Zurkei's Avatar Contributor

    Reputation
    91
    Join Date
    Apr 2007
    Posts
    405
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to fix this line
    PHP Code:
     if(mysql_num_rows(mysql_query("SELECT * FROM `accounts` WHERE `login`= '".$name."'))>0){ 
    As this site has syntax highlighting you can tell it is wrong as those last three )'s should be green not red.
    Where it should be something like this.
    PHP Code:
    if(mysql_num_rows(mysql_query('SELECT * FROM accounts WHERE login = "$name"'))>0){ 
    What you did wrong was that you do normally use " but if you have to use it more then once you want to use ' and then use " inside.
    Sorry if it is a bit confusing you also might have to fix my variable haven't touched PHP in a while and did it off the top of my head.

  3. #3
    tranced's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried to find the other thread i used to link it, because when i use the code you gave me(which was what was originally there) i get this error "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wowrequ1/public_html/home.php on line 17
    Please Try Again." On the thread the code line that i have in there is what the fix was for this problem. Then when i put that in i got the problem i posted back at the top.

  4. #4
    Zurkei's Avatar Contributor

    Reputation
    91
    Join Date
    Apr 2007
    Posts
    405
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try making the query a variable so lets says
    PHP Code:
    $query mysql_query('SELECT * FROM accounts WHERE login = "$name"'
    Then try doing
    PHP Code:
    if(mysql_num_rows($query) != 0) { 

    Once again all off the top of my head so not sure if it will work.

  5. #5
    tranced's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm. well this time it sort of did something different. I got that same error again saying "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wowrequ1/public_html/home.php on line 18
    Please Try Again. "But this time it also had 2 more errors regarding access to the DB. these were "Warning: mysql_query() [function.mysql-query]: Access denied for user 'wowrequ1'@'localhost' (using password: NO) in /home/wowrequ1/public_html/home.php on line 5"

    "Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/wowrequ1/public_html/home.php on line 5".
    First i feel like i should get the code working though, then worry about the DB access.

  6. #6
    Gravecorp's Avatar Member
    Reputation
    11
    Join Date
    Oct 2008
    Posts
    26
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want to fully test your code. Then get the access to the DB working. Else you cannot really test the essential parts of your code

  7. #7
    Zurkei's Avatar Contributor

    Reputation
    91
    Join Date
    Apr 2007
    Posts
    405
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure your MySQL is up to date, and do as Grave said.

  8. #8
    tranced's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm alright, my mySQL is up to date and up until that error i had no reason to believe it wasn't working(i actually thought it was lol) but ill work on that.

Similar Threads

  1. [Mangos] [Website] Mangos Account Creation Page Error.. Help?
    By Hyldran0 in forum WoW EMU Questions & Requests
    Replies: 14
    Last Post: 07-22-2010, 01:25 PM
  2. [MaNGOS] account creation page error :( HELP!
    By beerent in forum WoW EMU Questions & Requests
    Replies: 5
    Last Post: 04-06-2010, 05:35 AM
  3. [PHP] Need helping setting up account creation page.
    By c0ddingt0n in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 02-01-2009, 05:45 PM
  4. [Help] Need Mangos Account Creation Page
    By hahaowned in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 10-10-2007, 12:36 PM
  5. Account Creation Page
    By Squishyy in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 09-20-2007, 11:01 AM
All times are GMT -5. The time now is 08:38 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search