Results 1 to 4 of 4

Thread: [RESOLVED] I don't get it - SQL? Whats up with this

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2007
    Posts
    279

    Resolved [RESOLVED] I don't get it - SQL? Whats up with this

    PHP Code:
    <?
    //Database Information

    $dbhost = "";
    $dbname = "";
    $dbuser = "";
    $dbpass = "";
    //Connect to database

    mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
    mysql_select_db($dbname) or die(mysql_error());

    session_start();
    $username = $_POST[‘username’];
    $password = md5($_POST[‘password’]);

    $query = (“SELECT * from users where username=’$username’ and password=’$password’”); - THIS IS THE Erroneous Line 

    $result = mysql_query($query);

    if (mysql_num_rows($result) != 1) {
    $error = “Bad Login”;
        include “index.htm”;

    } else {
        $_SESSION[‘username’] = “$username”;
        include “X.php”;
    }

    ?>
    Error: Unexpected T_STRING on Line 17 ( See above) I've marked it.
    Last edited by penagate; Jun 2nd, 2007 at 07:10 PM. Reason: Added [php] tags

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: I don't get it - SQL? Whats up with this

    Make sure the quotemarks after $password are a follows: ONE single tick ' followed by a DOUBLE quote "

    Also take off the parens from the same line.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2007
    Posts
    279

    Re: I don't get it - SQL? Whats up with this

    Hi,

    Im using '""; after password, (looked like i wasn't in this forum) i only put in the brackets when I had that error before. I still have the error with:
    Code:
    $query = “SELECT * from users where username=’$username’ and password=’$password'";
    Whats wrong, i've tried using an Sql 4.0 and an SQL 5.0 db, no luck.

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: I don't get it - SQL? Whats up with this

    whatever text editor you're using (and copying from) isn't creating a double quote ("), but rather creating a different kind of quote (“). can you see the difference? one is a quote slanted in, and that just won't do.

    “"“" -- might be a bit hard to see the difference.

Posting Permissions

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



Click Here to Expand Forum to Full Width