Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: help with error

  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts

    help with error

    PHP Code:
    14 mysql_select_db("deb16598_samp") or die(mysql_error());
    15 $query "SELECT * FROM users WHERE name=".$sendedname .""
    16 mysql_query("".$query "") or die(mysql_error()); 
    i get errors here:


    Parse error: syntax error, unexpected T_STRING in public_html/stats.php on line 16

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    Line 15, forgot the semi-colan.

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Iszak View Post
    Line 15, forgot the semi-colan.
    ty man
    Last edited by Pandabeer; 03-05-2009 at 08:39 PM. Reason: 12345

  • #4
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    What? It should be..
    PHP Code:
    mysql_select_db("deb16598_samp") or die(mysql_error());
    $query "SELECT * FROM users WHERE name=".$sendedname."";
    mysql_query("".$query "") or die(mysql_error()); 
    You could probably remove the ."" at the end too because it's useless.

  • #5
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts
    double post >.>

    PHP Code:
    mysql_select_db("deb16598_samp") or die(mysql_error());
    $query "SELECT * FROM users WHERE name=".$sendedname ."";
    mysql_query(".$query . ") or die(mysql_error()); 
    now i got this:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.SELECT * FROM users WHERE name= .' at line 1

  • #6
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    It's basically you're query, check the value of $sendedname, and maybe clean your code up so it's more readible like..

    PHP Code:
    mysql_select_db("deb16598_samp") or die(mysql_error());

    $sql "SELECT * FROM `users`
              WHERE `name` = '{$sendedname}'"
    ;

    $query mysql_query($sql)
              or die(
    mysql_error()); 

  • #7
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Iszak View Post
    It's basically you're query, check the value of $sendedname, and maybe clean your code up so it's more readible like..

    PHP Code:
    mysql_select_db("deb16598_samp") or die(mysql_error());

    $sql "SELECT * FROM `users`
              WHERE `name` = '{$sendedname}'"
    ;

    $query mysql_query($sql)
              or die(
    mysql_error()); 
    this worked now, when i do this:

    PHP Code:
    <p><?php
    $name 
    $_GET['name'];?>
    Please
    fill in your name so we
    can check your account<br>
    CASE
    SENSITIVE!!
    </p>
    <div>
    <form action="stats.php" method="post">Username
    : <input name="sendedname" type="text"><br>
      <input value="Send" type="submit">&nbsp;&nbsp;<input value="Reset"
     type="reset">
    </form>
    </div>
    and than @ my stats

    PHP Code:
    <?php // Connects to your Database
    $sendedname $_REQUEST["name"];
    mysql_connect("my host.""my user.""my pass.") or die(mysql_error());
    mysql_select_db("deb16598_samp") or die(mysql_error());

    $sql "SELECT * FROM `users`
              WHERE `name` = '{$sendedname}'"
    ;

    $query mysql_query($sql)
              or die(
    mysql_error());
    Print 
    "<table border cellpadding=2>";
    while(
    $info mysql_fetch_array$query ))
    {
    Print 
    "<th>Name:</th> <td>".$info['name'] . "</td> </tr>";
    Print 
    "<th>Level:</th> <td>".$info['level'] . " </td></tr>";
    Print 
    "<th>Exp:</th> <td>".$info['exp'] . "</td> </tr>";
    Print 
    "<th>Drugs:</th> <td>".$info['drugs'] . " </td></tr>";
    Print 
    "<th>Cash:</th> <td>".$info['money'] . "</td> </tr>";
    Print 
    "<th>Bank money:</th> <td>".$info['account'] . " </td></tr>";
    Print 
    "<th>Job:</th> <td>".$info['job'] . "</td> </tr></tr>";
    }
    Print 
    "</table><br />";
    ?>
    it wont' work you know something to do about it?
    Last edited by Pandabeer; 03-05-2009 at 08:51 PM. Reason: sucks

  • #8
    New Coder
    Join Date
    Mar 2009
    Posts
    43
    Thanks
    2
    Thanked 0 Times in 0 Posts
    this worked now, when i do this:

    PHP Code:
    <p><?php
    $name 
    $_GET['name'];?>
    Please
    fill in your name so we
    can check your account<br>
    CASE
    SENSITIVE!!
    </p>
    <div>
    <form action="stats.php" method="post">Username
    : <input name="sendedname" type="text"><br>
      <input value="Send" type="submit">&nbsp;&nbsp;<input value="Reset"
     type="reset">
    </form>
    </div>
    and than @ my stats

    PHP Code:
    <?php // Connects to your Database
    $sendedname $_REQUEST["name"];
    mysql_connect("my host.""my user.""my pass.") or die(mysql_error());
    mysql_select_db("deb16598_samp") or die(mysql_error());

    $sql "SELECT * FROM `users`
              WHERE `name` = '{$sendedname}'"
    ;

    $query mysql_query($sql)
              or die(
    mysql_error());
    Print 
    "<table border cellpadding=2>";
    while(
    $info mysql_fetch_array$query ))
    {
    Print 
    "<th>Name:</th> <td>".$info['name'] . "</td> </tr>";
    Print 
    "<th>Level:</th> <td>".$info['level'] . " </td></tr>";
    Print 
    "<th>Exp:</th> <td>".$info['exp'] . "</td> </tr>";
    Print 
    "<th>Drugs:</th> <td>".$info['drugs'] . " </td></tr>";
    Print 
    "<th>Cash:</th> <td>".$info['money'] . "</td> </tr>";
    Print 
    "<th>Bank money:</th> <td>".$info['account'] . " </td></tr>";
    Print 
    "<th>Job:</th> <td>".$info['job'] . "</td> </tr></tr>";
    }
    Print 
    "</table><br />";
    ?>
    it wont' work you know something to do about it?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •